When we develop an app to write and read NFC tags, we most probably want this to happen when the user taps on a tag on their phone, and our app starts automatically even if it isn't running in the foreground. The Android system provides us with a pretty simple solution for this—AAR.
We are going to create an application that creates and writes an AAR to a tag by performing the following steps:
Open Eclipse and create a new Android application project named
NfcBookCh3Example4
with the package namenfcbook.ch3.example4
.Make sure the
AndroidManifest.xml
file is configured correctly (refer to the Requesting NFC permissions recipe of Chapter 1, Getting Started with NFC).Set the minimum SDK version to 14:
<uses-sdk android:minSdkVersion="14" />
Make sure the foreground dispatch system is enabled (refer to the Understanding the foreground dispatch system recipe in Chapter 2, Detecting a Tag).
Open
MainActivity
located undernfcbook.ch3.example4
...