I really like the section on AlarmManager in the CWAC Advanced Android book. I am now worried about my app's work being killed because it doesn't have a wake lock. Here's what I am worried about. Is my worry rational?
See code below. What if doWakefulWork has to start another service? In this case, the other service needs to acuire a WakeLock to keep running, however the is a gap in time between the service starting and onHandleIntent ending where the wakelock could be released!
@Override
final protected void onHandleIntent(Intent intent) {
try {
doWakefulWork(intent)
}
finally {
getLock(this).release();
}
}
My going answer is: doWakefulWork must execute on the same thread, it can't start other threads or services unless the other services are also WakefulIntentService instances.
Am I right?