My app has background service which keep on running even if app is killed from the task manager but when I have tested my app on MI(xiaomi) phone it kills my app service when I close the app from task manager and my service keep on running and work perfectly on all devices except MI even if I kill my app from task manager.
So how to keep my service running in background even when the app is killed from the task manager?
IntentServiceto have more optimized way of using background services.onDestroy()itself is not guaranteed to be fired every time app closes or exits. Also do check if there is anything to do with android versions in your 2 other phones as compared to Xiaomi