Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

intent-filter with android:priority setting

I test the intent-filter android:priority="0" and intent-filter android:priority="20" by 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 finishing system booting, it always pops up a dialog (ResolveActiivty) for choose preferred activity for this intent...

Can anyone can help this? is it error usage for android:priority?

Thanks!

like image 638
Gary Wang Avatar asked Dec 25 '09 01:12

Gary Wang


2 Answers

I haven't actually seen android:priority being taken into account when the system is resolving intents. I just tried setting a priority on an intent-filter that I use, but the system still gave me the resolution popup dialog, no matter what value I set my intent-filter's priority to.

I guess you'll just have to select the home screen activity you want to use (i.e. yours) and select the "Use by default..." checkbox.

like image 165
Christopher Orr Avatar answered Sep 25 '22 15:09

Christopher Orr


android:priority is only used on OrderedBroadcast intents, not the order of resolution for non-ordered broadcasts. Users select the default activity for a given action, which is why the dialog pops up. So, yes, you are using priority incorrectly.

like image 30
Jim Avatar answered Sep 22 '22 15:09

Jim