NontKub K.
NontKub K.

Reputation: 13

NFC tag detection

I create android app to read NFC tag ID I have finish that but that last thing what I want is I want to run my app when tag is detected while my app is closed.Example when I close my app and get my phone to touch NFC tag after that the phone will detect it and run my app to read TAG id. How I can do this ? I try to use Service but it not work.

thank you for Anwser and sorry with my english

Upvotes: 1

Views: 1483

Answers (1)

Sana
Sana

Reputation: 9915

Use the concept of intent filter for NFC.

What kind of NFC tags are you targetting?

Below is a sample code which starts your activity when the NFC tag is discovered that has stored data in text format.

<intent-filter>
  <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
  <data android:mimeType="text/plain"/>
  <category android:name="android.intent.category.DEFAULT"/>
</intent-filter>

Upvotes: 1

Related Questions