If you are developing an application that writes a specific data object into the tag, you should use the external type records. The payload doesn't need to follow any specific structure like it does in the text records. We can also use these types to create generic records for better support in both Android and non-Android devices since these are simpler ndef
records.
We are going to create an application that creates and writes an NDEF Message that contains an NFC Forum External Type-formatted ndef
record to a tag:
Tip
Please note that this recipe requires API level 16 to run and will not work with the OpenNFC Simulator since it is sunning API level 15. It should be tested using a real device.
Open Eclipse and create a new Android application project named
NfcBookCh3Example5
with the package namenfcbook.ch3.example5
.Make sure the
AndroidManifest.xml
file is configured correctly (refer to the Requesting NFC permissions recipe in Chapter 1, Getting...