NFC - Open an Android App
- Ameba x 1
- Smartphone with NFC feature x 1
Example
Android system provides NDEF format to Android applications, it is called AAR (Android Application Record). The content of each AAR is the name of the Android application. When a smartphone senses NFC Tag with AAR information, it opens the corresponding Android app or opens the download page of this app in Google Play (if it is not installed on the smartphone).
First open the example, “File” -> “Examples” -> “AmebaNFC” -> “GooglePlayApp”
Compile and upload to Ameba, then press the reset button.
Bring the back of the smartphone close to the NFC antenna of Ameba.
Then you can see the Facebook app is launched.
Code Reference
Fill in the app name to be launched in appendAndroidPlayApp().
NfcTag.appendAndroidPlayApp("com.facebook.katana");
Note that the “app name” here refers to the “package name” of the application. To get the package name, open the Google Play page of the app, and the package name is contained in the url field:
Then call NFC.begin() to start the NFC module.