Question

In the Android API, we are told the following:

If a tag contains an AAR, the tag dispatch system dispatches in the following manner:

  1. Try to start an Activity using an intent filter as normal. If the Activity that matches the intent also matches the AAR, start the Activity.

  2. If the Activity that filters for the intent does not match the AAR, if multiple Activities can handle the intent, or if no Activity handles the intent, start the application specified by the AAR.

  3. If no application can start with the AAR, go to Google Play to download the application based on the AAR.

Part 2 of this is a little bit confusing. If the intent matches more than one Activity then we launch the application. So if my activity that filters for the NFC intent is not my default application launch activity, I will not be starting it in the case where multiple activities filter for the intent?

Put another way, if my application has a default Activity 'A' and another activity 'B' that filters for an NFC intent, then without any other activities filtering for that intent, an AAR intent will launch B. But if others DO filter for the intent, I will get a different behaviour and activity A will be started.

Does this mean I may as well make the intent filter always sit on Activity A (the default launch activity) as there is always a chance the intent will be delivered to it?

Hope this was clear,

Sam

Was it helpful?

Solution

So if multiple Activity filters match, Android defaults to the main application Activity.

Seems better than selecting one (which?) of the matching Activities. If you write 'competing' filters, this is what you get, but no one is forcing you ;-)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top