There's a new method in NdefRecord that allows writing AndroidApplicationRecord to the NdefMessage. This was not necessary in pre Ice-Cream-Sandwich, but since then if you want to handle specific URI from a NFC tag in your application (like defined in the intent-filter) it will not be delivered to your application, unless you define that record.
createApplicationRecord(String packageName);
This is not available with some kind of compatibility package (I didn't find one), but the implementaion is fairly simple.
First add your NdefRecord you want to be readable by any NFC device
(remember that URI can be formatted/shortened with URI_PREFIX_MAP
)
NdefRecord[] nr = new NdefRecord[2];
nr[0] = new NdefRecord(NdefRecord.TNF_WELL_KNOWN, NdefRecord.RTD_URI, new byte[0], uriBytes);
Add your AAR in the next place
static final byte[] RTD_ANDROID_APP = "android.com:pkg".getBytes();
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH)
nr[1] = NdefRecord.createApplicationRecord("your.package.name");
else
nr[1] = new NdefRecord(NdefRecord.TNF_EXTERNAL_TYPE, RTD_ANDROID_APP, new byte[] {}, "your.package.name".getBytes());
You do not need an AAR to handle a specific URI. The AAR is just another method to guarantee that your app is started instead of another app that can handle the same URI.