0

I am trying to create an intent that would match the following test intent filter :

<intent-filter>
   <action android:name="com.android.testApp.app.testAction"/>
   <action android:name="com.android.testApp.app.testAction_2"/>
   <category android:name="android.intent.category.DEFAULT" />
   <category android:name="com.android.testApp.app.testCategory" />
</intent-filter>

The intent resolution rules state that if intent doesn't contain any action, it can pass the action test, as long as the intent filter contains at least 1 action.

Also, all categories in intent must be present in the intent filter.

I created the following intent :

 Intent intent = new Intent();
 intent.addCategory("com.android.testApp.app.testCategory");
 startActivity(intent);

However, this intent can't pass the intent filter. Can some one point out why ?

Jake
  • 16,329
  • 50
  • 126
  • 202
  • as you have 2 action you would need something like this: http://stackoverflow.com/questions/11021021/how-to-make-an-intent-with-multiple-actions – ligi Jun 24 '14 at 08:08
  • @ligi I want to test without specifying any actions in the intent. According to the rules, it should pass right ? – Jake Jun 24 '14 at 08:10
  • but your intent-filter has actions – ligi Jun 24 '14 at 08:11
  • @ligi From documentation : if an Intent does not specify an action, it will pass the test (as long as the filter contains at least one action). – Jake Jun 24 '14 at 08:11
  • @ligi http://developer.android.com/guide/components/intents-filters.html#ActionTest – Jake Jun 24 '14 at 08:12
  • @ligi is the documentation wrong ? – Jake Jun 24 '14 at 08:13

0 Answers0