rve rve - 1 year ago 85
Android Question

Is it OK to call sendBroadcast() from another thread?

I have a service which creates a thread. This thread does some work and then calls

on the
. This means
is called from the worker thread and not from the thread the service is running in.

Is this OK or should I make sure
is called from the same thread as the
(by using
) ?

I found this on stackoverflow and Dianne Hackborns post.

According to the post it should be fine. The reason I ask is because the post is 2 years old and maybe something has changed. Also I could not find anything about this in the Android documentation.

Answer Source

That is fine. The Broadcast is handed to the Android OS and it is actually sent using OS threads so your thread that sends it does not matter.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download