The Android system works with individual applications using a series of sections of standard code to make sure the applications interact with the system in a stable manner. An Android broadcast is a message sent through the operating system itself to individual applications. A sticky broadcast is one that remains accessible to applications after the initial sending and reception.
Other People Are Reading
Broadcasts and receivers
Messages from both individual applications and the Android operating itself, designed to go to applications, go through an Android OS feature known as broadcasts. When the system sends out a broadcast, the information goes to every app that has a relevant receiver. The receiver is part of the code for the app and indicates that the app needs to receive any broadcasts of messages about a particular event. These broadcasts are known as system broadcasts. As an example, the system might send a broadcasts to say an Android smartphone is taking a call; a music app set up to receive broadcasts about this event could receive this message and know to pause playback.
In normal circumstances the system will send out broadcasts and then delete them once they have been received by all relevant apps, something that can save resources. In some cases apps might need to check information from a broadcast later on rather than just access it immediately. The solution is to label the broadcast as a sticky broadcast. This means apps can retrieve the relevant data from the system at any point until a fresh broadcast updates or replaces the data.
Android doesn't allow individual apps to communicate directly with one another. This barrier is designed to maintain both security and stability. If an app wants to send information to other apps, it must issue code that is called an intent. The intent is simply a message and details of what type of apps need to see it. The operating system then checks the validity of the message and then relays it to relevant apps as a broadcast. These broadcasts can be in the normal manner or can be sticky broadcasts.
When an app issues an intent, it can request that the resulting broadcast be a sticky broadcast. However, for this to work the app itself must include "BROADCAST_STICKY" among its list of permissions. Permissions are a way for users to see what authority the app will have in interacting with the system and device. If the app doesn't have the "BROADCAST_STICKY" permission, then the system will refuse the intent request for a sticky broadcast.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for