Based on this documentation available at Android NFC doc:
If a tag contains an AAR, the tag dispatch system dispatches in the following manner:
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.
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.
If no application can start with the AAR, go to Google Play to download the application based on the AAR.
From those lines I understand that if I specify an intent filter for an activity A
and the received NDEF message matches the filter of A
, A
will be started even if the NDEF message contains the AAR record of the app that A
belongs to.
In my case A
starts only if there is no AAR record. As soon as I add the AAR record, the activity A
is not started: when the NDEF message is detected, the main activity of the app indicated in the AAR is launched.
What do they mean with "if the Activity [...] also matches the AAR"?
Is there anyone who can provide a hint?
This means that activity A has an
NDEF_DISCOVERED
intent filter that matches the datatype of the first NDEF record of the NDEF message on the tag and that the AAR matches the application package name that activity A belongs to.This means that there is
NDEF_DISCOVERED
intent filter that does not match the datatype of the first NDEF record of the NDEF message on the tag and that the AAR matches the application package name that activity A belongs to,NDEF_DISCOVERED
intent filter that matches the datatype of the first NDEF record of the NDEF message on the tag and that the AAR matches the application package name that activities A and B belong to, orNDEF_DISCOVERED
intent filter.In that case, the app that has a package name that matches the one in the AAR is started by sending intent action
MAIN
with categoryLAUNCHER
for the first activity in your app that has such an intent filter. Hence, the app is "started" as if the launcher icon for that activity was clicked.This means that if there is no app with a package name that matches the one in the AAR, then Play Store is opened.
So, for instance, if you have the NDEF message
then you would need an application with the package name
com.example.app
that has one activity with an intent filter likeScenario 1 (match for activity A):
Scenario 2a (no match for activity A, MAIN is launched):
Scenario 2b (match for activities A and B, MAIN is launched):
Scenario 2c (no
NDEF_DISCOVERED
intent filter, MAIN is launched):