Question

I have a service A, which is started by WakefulBroadcastReciever from AlarmManager. Service A follows a standard pattern - performs a computation, then sends local broadcast to inform the system about the results, then calls WakefulBroadcastReceiver.completeWakefulIntent().

Depending of the results of the computation,i.e. content of the local broadcast, other local services may need to perform some computation immediately. However, am I guaranteed that the other services will receive the local broadcast at all before the device goes back to sleep?

If not, I guess another solution would be to use explicit callbacks. Is there a standard pattern for this?

Thanks!

Was it helpful?

Solution

Local Broadcast manager has a sync mode. Beware ! The onReceive runs in the thread it is called from - not the main (UI) thread.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top