Search code examples
androidandroid-serviceandroid-wake-lock

What happens to an Android service when PowerManager.goToSleep is called?


I'm trying to figure out what happens to an android service when PowerManager.goToSleep() is called.

Say the device is asleep for x amount of time. When the device comes out of the sleep state, there are no LifeCycle methods like onPause() or onRestart() within a service that are used to notify the service of the change.

I know that according to the documentation, all WakeLocks are overridden, so does that imply that the service will be destroyed and not started again?

http://developer.android.com/reference/android/os/PowerManager.html#goToSleep%28long%29


Solution

  • so does that imply that the service will be destroyed and not started again?

    No. It implies that the service is unchanged. All sleep mode does is stop the CPU.