Is it possible to set the priority attribute of a BroadcastReceiver programmatically or can it only be done in XML? Relevant documents include:
http://developer.android.com/reference/android/content/BroadcastReceiver.html
http://developer.android.com/reference/android/R.styleable.html
It doesn't seem so, but I don't fully understand the relationship of android.R.styleable to a given application and its activities...
A broadcast receiver is implemented as a subclass of BroadcastReceiver class and overriding the onReceive() method where each message is received as a Intent object parameter.
Retrieve the current result extra data, as set by the previous receiver. This can be called by an application in onReceive(Context, Intent) to allow it to keep the broadcast active after returning from that function.
A Service receives intents that were sent specifically to your application, just like an Activity. A Broadcast Receiver receives intents that were broadcast system-wide to all apps installed on the device.
You don't set priority on BroadcastReceiver
(or Activity
) objects, but instead on the IntentFilter
object(s) that cause these items to be started.
With that in mind, IntentFilter.setPriority()
is what you want to use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With