Apps NODE: AlarmManager, PowerManager.WakeLock and asynchronous call?

Imo_nac_

Lurker
Hi
I have a class called AlarmHandlerAndReceiver (extends BroadcastReceiver) that has a method to set the AlarmManager, another one to cancel AlarmManager and nother one to reschedule AlarmManager and sure the onReceive

When onReceive takes place I acquire a PowerManager.WakeLock, send an intent to the app service then i ReScheduleAlarm and then release PowerManager.WakeLock

This means that i want to execute a take (intent) in the service in a periodic manner, say from minute to minute.

So my question is:

When the onreceive takes place i use a PowerManager.WakeLock in order to avoid device fall asleep to be possible to reschedule the alarm again.
However, the task call (on the service) is asynchronous (Intent) and in the meanwhile the PowerManager.WakeLock is released in the AlarmHandlerAndReceiver class.

What hapens if the service task is still running and the device fall asleep?
Is it needed to protect this? Should i make a synchronous task call (via application class?)

Thanks a lot

Alex
 
Top