Android Application Records (AAR): Make an NFC Tag Open Your App
An Android Application Record (AAR) stores your app's package name in an NDEF record. Scan the tag and Android starts that app, or sends the person to Google Play if it isn't installed.
What an Android Application Record is
An Android Application Record (AAR) is an NDEF record that holds an app's package name. Put one in a tag's message and Android starts that app when the tag is scanned, or sends the person to Google Play to install it.
AARs arrived in Android 4.0 (API level 14). The Android NFC guide describes them as a way to get "a stronger certainty that your application is started when an NFC tag is scanned." You build one with NdefRecord.createApplicationRecord(packageName), and the API reference says you can embed it anywhere in the message.
val message = NdefMessage(
arrayOf(
NdefRecord.createUri("https://example.com/start"),
NdefRecord.createApplicationRecord("com.example.myapp")
)
)
Android searches the whole NDEF message for AARs, so the record doesn't need a special slot. It just needs the app's exact package name, the one shown in its Google Play listing.
How Android decides which app opens
Without an AAR, any app with a matching intent filter can claim the tag. With one, Android works through three steps, in this order:
- It tries an activity with a matching intent filter. If that activity belongs to the app named in the AAR, it starts.
- If the matching activity doesn't belong to the AAR's app, if several activities could handle the intent, or if none can, Android starts the app named in the AAR.
- If no app can start from the AAR, Android goes to Google Play to download it.
An AAR doesn't skip intent filters. It settles who wins when apps compete. The Android guide says AARs are useful "to prevent other applications from filtering for the same intent and potentially handling specific tags that you have deployed." That matters if you ship tags to customers who might have other NFC apps installed.
AARs work at the app level only. You can't point one at a particular screen. To land on a specific activity, use intent filters on the URI or MIME record instead.
What happens when the app isn't installed
Android opens Google Play for the package in the AAR. The reference page words it as a market link opened for the first listed app. That's what turns a tag into an install prompt, handy for a product sticker or a poster. For tags that need no app at all, see what reads a tag when no app is involved.
If a message holds several AARs, the reference says the apps are preferred targets "in the order in which they appear in the message."
Where to put the AAR in the message
Don't put it first, unless it's the only record. The guide explains why: Android reads the first record to work out the MIME type or URI it builds the intent from. An AAR in slot one leaves nothing for intent filters to match.
Put the URI or MIME record first and the AAR last, as in the example above. The guide also recommends combining AARs with MIME types or URIs to reach the widest range of devices, because AARs are specific to Android 4.0 and later. The Android pages don't say how other platforms treat an AAR, so don't count on it for iPhones. A URL record gives them something to open; add a URL fallback for iPhone shows the idea on a Wi-Fi tag.
Where an AAR can't help
- Foreground dispatch wins. An AAR doesn't overrule an app that has called
enableForegroundDispatch. The Advanced NFC page says that system lets an activity "claim priority over other activities that handle the same intent." - Newer Android versions add user controls. From Android 16, people are notified when an app receives its first NFC intent and can block it under "Launch via NFC." Android 17 adds a
DISPATCH_NFC_MESSAGEpermission requirement for apps that target newer SDKs, and it stops dispatching NFC intents to stopped apps. The Android guide doesn't say how these affect AAR launches, so test on current phones. - A phone case or a bad write can look the same. If you see No supported app for this NFC tag, check the tag's contents before blaming the AAR.
To confirm a tag really carries an AAR, read its records back with a tag reader. NFCore shows what's stored on a tag, and there's an Android version too.
Quick recap
Use an AAR when a tag must open one specific Android app, or send people to install it. Keep the package name exact, put the AAR after a URI or MIME record, and expect foreground apps and newer Android privacy controls to take priority. Always test the finished tag on a real phone.
Frequently Asked Questions
Does an AAR work on iPhone?
The Android documentation presents AARs as an Android feature (Android 4.0 and later) and doesn't say how other platforms treat them. Pair the AAR with a URL or MIME record so the tag still does something useful elsewhere, and test on the devices you care about.
What happens if the app isn't installed?
Android opens Google Play so the person can download the app named in the AAR.
Can an AAR open a specific screen in my app?
No. AARs work at the app level, not the activity level. To reach a certain activity, use intent filters on the other records in the message.