Android BroadcastReceiver suggest change

Sticky Broadcast

If we are using method sendStickyBroadcast(intent) the corresponding intent is sticky, meaning the intent you are sending stays around after broadcast is complete. A StickyBroadcast as the name suggests is a mechanism to read the data from a broadcast, after the broadcast is complete. This can be used in a scenario where you may want to check say in an Activity's onCreate() the value of a key in the intent before that Activity was launched.

Intent intent = new Intent("com.org.action");
intent.putExtra("anIntegerKey", 0);
sendStickyBroadcast(intent);

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents