Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Yet another approach is to use the LocalBroadcastManager class. Using this class the intent broadcast it never going goes outside of the current process. According to the Android API Reference, LocalBroadcastManager has a number of advantages over Context.sendBroadcast(Intent):

  • You know that the data you are broadcasting won't leave your app, so don't need to worry about leaking private data.
  • It is not possible for other applications to send these broadcasts to your app, so you don't need to worry about having security holes they can exploit.
  • It is more efficient than sending a global broadcast through the system.

...