Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the integer value that gives a broadcast receiver highest priority?

What is the integer value the gives a broadcast receiver the highest priority?

<intent-filter android:priority="1">
  <action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
like image 532
confucius Avatar asked Jul 01 '11 16:07

confucius


People also ask

What is the integer that represents the highest priority?

And the highest priority possible would be the maximum integer that android allows, which is (2^31 - 1).

What is broadcast receiver?

Broadcast Receiver Overview. A broadcast receiver is an Android component that allows an application to respond to messages (an Android Intent ) that are broadcast by the Android operating system or by an application.

What is intent filter priority?

An intent filter declares the capabilities of its parent component — what an activity or service can do and what types of broadcasts a receiver can handle. It opens the component to receiving intents of the advertised type, while filtering out those that are not meaningful for the component.

What are the types of broadcast receivers?

There are two types of broadcast receivers: Static receivers, which you register in the Android manifest file. Dynamic receivers, which you register using a context.


1 Answers

Well, according to the documentation

"The value must be an integer, such as "100". Higher numbers have a higher priority."

So I'm guessing that any integer value is valid. And the highest priority possible would be the maximum integer that android allows, which is (2^31 - 1).

EDIT

The documentation has been updated, and it now explicitly states which priority values may be used by applications. The documentation now says

SYSTEM_HIGH_PRIORITY (1000): Applications should never use filters with this or higher priorities. SYSTEM_LOW_PRIORITY (-1000): Applications should never use filters with this or lower priorities.

Implying that your application is permitted to use integer priority levels between -999 and 999.

like image 122
theisenp Avatar answered Oct 15 '22 13:10

theisenp