Does BroadcastReceiver.onReceive always run in the UI thread?

Hannes Struß picture Hannes Struß · Apr 15, 2011 · Viewed 49.8k times · Source

In my App, I create a custom BroadcastReceiver and register it to my Context manually via Context.registerReceiver. I also have an AsyncTask that dispatches notifier-Intents via Context.sendBroadcast. The intents are sent from a non-UI worker thread, but it seems that BroadcastReceiver.onReceive (which receives said Intents) always runs in the UI thread (which is good for me). Is this guaranteed or should I not rely on that?

Answer

CommonsWare picture CommonsWare · Apr 15, 2011

Does BroadcastReceiver.onReceive always run in the UI thread?

Yes.