Xiomi devices. I have gave Auto start permission and disabled battery protection. However, it stops service when i close the app. How can i fix that?
you can't
you are using START_NOT_STICKY while you should use START_REDELIVER_INTENT , however if it's related to Xiaomi devices , you can use JobScheduler or Alarm Manager to check your Service state and Re-run it if it's dead , https://developer.android.com/reference/android/app/Service#START_REDELIVER_INTENT
Обсуждают сегодня