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

Filtering tags by their technology using programs

There are several types of NFC tags. They mostly differ on the storage capacity and on the communication standard used. In our application, we may want to use only a specific type of tag because of a certain characteristic of that specific tag. The Android SDK supports the most frequent tag types such as MIFARE Classic and MIFARE Ultralight tags.

How to do it...

By performing the following steps, we will create an application that is executed only when the programmatically defined technology filters match the ones specified by us:

  1. Open Eclipse and create a new Android application project named NfcBookCh2Example4 with the package name nfcbook.ch2.example4.

  2. Open located under nfcbook.ch2.example4, implement the following method, and invoke it in the onResume method:

    void enableForegroundDispatch() {
      Intent intent = new Intent(this, MainActivity.class).
      PendingIntent pendingIntent...