The following is a list here of all the differences between Implicit Intents(sent viastartActivity()
) andBroadcasts(sent viasendBroadcast()
)
There is no way for a BroadcastReceiver to see or capture Intents used with startActivity(); likewise, when you broadcast an Intent, you will never find or start an Activity. These two operations are semantically very different: starting an Activity with an Intent is a foreground operation that modifies what the user is currently interacting with; broadcasting an Intent is a background operation that the user is not normally aware of.
The description is shown below:
Broadcasts are just that -- messages broadcast to anyone listening. They are inherently insecure, and delivery to the intended recipient isn't guaranteed, because there really isn't an intended recipient. For example, theCONNECTIVITY_CHANGE
broadcast makes this quite clear: When connectivity changes in an Android device, many apps might be interested. Rather than theConnectivityManager
having to notify each app via specificIntent
, it sends a broadcast. Any app that has registered interest in this event will be notified. Any app that isn't running or doesn't care... won't.
AnIntent
is "sent" when one app orActivity
wants to launch another to do something very specific. For example, a file-manager might want to launch an image viewer or video player. Your app might want to launch a very specificActivity
within another one of your apps, etc. The communication by specific intents (i.e. including package name and component name) can not easily be intercepted, so it's somewhat more secure. Most importantly, there's only and exactly one "receiver" -- if none can be found, theIntent
will fail.
Further, aBroacastReceiver
will be active within anActivity
orService
and received broadcasts will generally only change state and/or do minor UI updates... for example, you might disable a few actions if your internet connectivity is dropped. By comparison, a specific Intent will usually launch a newActivity
or bring an existing one to the foreground.