On some devices (some LG, Huawei, Xiaomi, and others), your application must be manually added to the list of “protected applications” or “applications allowed to work in the background” for Android to restart STICKY Services. If your application is not manually added to this list, Android simply kills your processes and does not restart them, nor does it call onTaskRemoved() . This is done to save battery life by limiting the number of applications that STICKY services can run in the background.
On such devices, you should see the page in the "Settings", sometimes under "power management", sometimes in other places where you need to explicitly add the application. You will also need to tell your users to explicitly add your application to this list.
David Wasser Feb 08 '17 at 17:54 on 2017-02-08 17:54
source share