Droidman
Droidman

Reputation: 11608

android - trying to detect any NFC tag

I got a plastic card with an NFC tag of unknown type, when I touch my Nexus 7 with it a short sound is playing, nothing more. I was curious if I can react to NFC tags from my app, so I declared the following filters for my Activity since I don't know the type of the Tag:

 <intent-filter>
            <action android:name="android.intent.action.MAIN" />
    <action android:name="android.nfc.action.NDEF_DISCOVERED" />
            <action android:name="android.nfc.action.TECH_DISCOVERED" />
            <action android:name="android.nfc.action.TAG_DISCOVERED" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

But it does nothing when I touch the tag. It also does not react to an XPERIA smart tag. What am I missing? Can detect NFC tags without knowing the type of the tag? I mean perform the same simple action (like setting a text) when a tag touch is detected.

Upvotes: 0

Views: 1224

Answers (1)

NFC guy
NFC guy

Reputation: 10228

Instead of <category android:name="android.intent.category.LAUNCHER" /> you need to use <category android:name="android.intent.category.DEFAULT"/>.

Upvotes: 1

Related Questions