Android NFC: Reading tag does not work
I want to create an application that can read a tag. I copied the NFCDemo code, but that did not work. I also added
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<data android:mimeType="mime/type" />
</intent-filter>
<开发者_高级运维;intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED" />
<meta-data android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="@xml/nfc_tech_filter" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
to my manifest file.
But the application is never called / opened when I hold the tag at my Nexus S.
Thanks for any help!!
To make it easy at the beginning, remove all the intent filters but the TAG_DISCOVERED one. This is the most basic one. Once the NFC chip will discover a NFC tag, it will send out and event with TAG_DISCOVERED. If you have registered teh intent filter to an activity you should then see the intent chooser with your app in it.
精彩评论