Skip to content Skip to sidebar Skip to footer

Alarm Does Not Wake Up My Service

I have the following code, I expect that this alarm invokes my Service regardless of the state of the phone. Even if its in sleep mode, I need it to access the internet and make so

Solution 1:

Why doesn't it work when the phone is in sleep mode ?

Because startService() is asynchronous, and Android only guarantees that a _WAKEUP alarm will keep the device awake until onReceive() ends. You will need to use a WakeLock, either directly or by means of using my WakefulIntentService.


Post a Comment for "Alarm Does Not Wake Up My Service"