I am working on a app locker which has some background services (to lock apps). I am using Xiaomi Redmi Note 4g for the development. The MIUI has an in-built task manager which can be used to kill running apps. When I kill apps with this, all services, broadcastreceivers and alarmmanagers are getting removed (as expected from a task manager). My requirement is to prevent my background services from getting cleared from task-killers, but if the user navigates to settings and force closes, the service should stop. How do I achieve this?
Btw, I know that its not impossible to achieve this since Whatsapp and Truedialer (some egs) are already doing this on the latest android versions.
My observations from Whatsapp:
I've solved the problem.
Solution for MIUI 7.0 => Security => Autostart => select Apps that you want to run in background => Reboot After reboot your device should able to run your application services in background like other android devices do.