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:
Open Eclipse and create a new Android application project named
NfcBookCh2Example4
with the package namenfcbook.ch2.example4
.Open
MainActivity.java
located undernfcbook.ch2.example4
, implement the following method, and invoke it in theonResume
method:void enableForegroundDispatch() { Intent intent = new Intent(this, MainActivity.class). ddFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); PendingIntent pendingIntent...