Intent filter with android setting: priority

I am testing the android:priority="0" filter intent and the android:priority="20" filter intent on android.intent.category.HOME . I list the information below

  <activity android:name=".TestHomeActivity" android:label="@string/app_name"> <intent-filter android:priority="0"> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.HOME" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> 

When the system boots up, a dialog (ResolveActiivty) always appears to select the preferred activity for this intention ...

Can anyone help? is it using errors for android:priority ?

Thanks!

+3
android android-manifest
source share
3 answers

I have not actually seen android:priority taken into account when the system decides intentions. I just tried to set the priority in the intent filter that I use, but the system still gave me a pop-up permission dialog, no matter what value I set for my filter filter priority.

I think you just need to select the activity of the home screen that you want to use (i.e. yours) and check the box "Use by default ...".

+3
source share

android:priority used only for the purposes of OrderedBroadcast, and not for the resolution order for non-standard transmissions. Users select the default action for this action, so a dialog box opens. So yes, you are using priority incorrectly.

+3
source share

From your snippet, it looks like you are trying to run the application. Priority is the one that must be granted to the wrt parent component to handle the intent of the type described by the filter.

It provides information about the ability of an action to respond to an intent that matches the filter relative to other actions. It also controls the execution order of broadcast receivers for receiving broadcast messages. Use this attribute only if you really need to impose a specific order in which broadcasts are received, or if you want to make Android prefer one action over others.

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

+1
source share

All Articles