2

I need to start a service after device boot before the user unlock the device. I have a BroadcastReceiver listening to LOCKED_BOOT_COMPLETED and BOOT_COMPLETED, and it is directBootAware. The service started by the BroadcastReceiver is also directBootAware. On device reboot, it seems the BroadcastReceiver is called and tried to start the service. but, the service is not started until user unlocks the device.

Anyone knows how to solve this?

jarly
  • 231
  • 1
  • 4
  • 16
  • [I would suggest you to return START_STICKY - which tries its best to re-run the service once its destroyed due to any reasons.](https://stackoverflow.com/questions/27499431/how-to-set-the-priority-of-android-service) – Mehran Zamani Jul 08 '17 at 08:20
  • I already anwared this in https://stackoverflow.com/questions/2784441/trying-to-start-a-service-on-boot-on-android?answertab=active#tab-top – San Juan Oct 24 '17 at 21:23

0 Answers0