views:

571

answers:

2

Dear all,

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!

+1  A: 

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.

Christopher
Now I can't remember what priority I tried to override, but check out this helpful answer from one of the Android developers: http://stackoverflow.com/questions/2023811/catching-market-search-intents#comment-1947212
Christopher
A: 

From your snippet, it seems that You are trying to launch your application. Priority is the one that should be given to the parent component w.r.t handling intents of the type described by the filter.

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

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

Vishwanath