Search code examples
androidandroid-servicewakelock

Will "START_STICKY" service prevent android from sleeping?


If I start a service with "START_STICKY" mode (android was awake when this service was started), does this make sure that the service will keep running (in the sleep mode / prevent android from sleeping) even if the screen is off and the device is not plugged in?

In other words, once a service is started in "START_STICKY" mode, is it required to acquire a wake lock to make sure android doesn't sleep? Or, is it guaranteed that once such a service is started, android will not sleep until the service is stopped by the app?


Solution

  • does this make sure that the service will keep running (in the sleep mode / prevent android from sleeping) even if the screen is off and the device is not plugged in?

    No.

    is it required to acquire a wake lock to make sure android doesn't sleep?

    Yes.