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
About the Author
About the Reviewers

Reading external types

In this recipe, we will see how we can identify external type formatted tags by testing the RDT value present in the first record with our external type formatted tags in the form.

How to do it…

This code complements the recipe where we learned how to write a URI into a tag. Refer to the Working with external types recipe in Chapter 3, Writing Tag Content.

  1. Open Eclipse and create a new Android application project named NfcBookCh5Example5 with package name com.nfcbook.ch5.example65.

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

  3. Import the NfcHelper class into the project and enable the foreground dispatch system.

  4. Add the following class member and instantiate it in the onCreate method:

    private NfcHelper nfcHelper;
    protected void onCreate(Bundle savedInstanceState) { 
      nfcHelper = new NfcHelper(this); 
  5. Override the onNewIntent method and place...