Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>1) Broadcast Receivers are a mechanism to receive messages (intents) globally without having any UI. They are good to pass information between different components like Service, Activity or even BroadcastReceiver itself. They can be defined in manifest to listen specific action and do stuff (for e.g launching service/activity) even if your app is not running. However, in activityForResult, your app (activity) must be running in order to receive results, which may not be suitable all the times.</p> <p>2) Yes, if your <em>action string</em> is known to other apps, then your broadcasts are exposed to any receiver which listens to those specific actions. To avoid this, use <strong>LocalBroadcastManager</strong>.</p> <p>3) Using <em>LocalBroadcastManager</em> is the best way to increase privacy by ensuring that your broadcast will only be broadcasted and listened within your <em>application's context</em>. Other applications cant listen to such broadcasts as they are having their own context and unaware of your app's context.</p> <blockquote> <p><em>As per google docs for LocalBroadcastManager</em>:</p> <ul> <li>You know that the data you are broadcasting won't leave your app, so don't need to worry about leaking private data.</li> <li>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.</li> <li>It is more efficient than sending a global broadcast through the system</li> </ul> </blockquote> <p>Final words: If you need to broadcast messages within your app and don't want to send them globally, then <strong>LocalBroadcastManager</strong> is the best choice. Otherwise go with the ordinary way</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload