Book Image

Near Field Communication with Android Cookbook

By : Vitor Subtil
Book Image

Near Field Communication with Android Cookbook

By: Vitor Subtil

Overview of this book

Table of Contents (17 chapters)
Near Field Communication with Android Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Working with external types


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.

How to do it...

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.

  1. Open Eclipse and create a new Android application project named NfcBookCh3Example5 with the package name nfcbook.ch3.example5.

  2. Make sure the AndroidManifest.xml file is configured correctly (refer to the Requesting NFC permissions recipe in Chapter 1, Getting...