-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Near Field Communication with Android Cookbook
By :
The Android system has a structured way to deal with the different tag types, technologies, and content. In this recipe, we will create a simple app that will allow us to visualize the implemented structure.
By performing the following steps, we are going to create an application that will allow us to see the triggered action when we tag different tags in our device:
Open the MainActivity.java file from the previously created NfcBookCh2Example1 project.
On the onNewIntent method, add the following lines of code:
String action = intent.getAction(); Toast.makeText(this, action, Toast.LENGTH_SHORT).show();
Open the NFC Simulator tool and simulate a few taps for different tag types and then see the results.
In the NFC Simulator tool, when tag names end with _LOCKED, it means that the tags are formatted and have content on them; probably, an NDEF record. Therefore, the NDEF_DISCOVERED action will be triggered. Unformatted tags will trigger the...
Change the font size
Change margin width
Change background colour