我正在开发一种与某些VCard标签完美配合的NFC应用程序。
现在,我想使用客户发给我的一些不同的标签。
Android设备(Nexus 4和Galaxy Nexus)正在发出NFC哔声,但没有应用程序出现,没有意图选择...
这是Intent的Manifest条目:
<activity
android:name=".ResultActivity"
android:label="Alcatel Scan"
android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" >
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
当我扫描标签时,这是相关的logcat:
12-28 12:29:35.599: D/ACDB-LOADER(164): ACDB -> send_afe_cal
12-28 12:29:35.609: D/NativeNfcTag(923): Connect to a tech with a different handle
12-28 12:29:35.619: D/alsa_ucm(164): Set mixer controls for HiFi Lowlatency enable 1
12-28 12:29:35.619: D/ALSAModule(164): Device value returned is hw:0,14
12-28 12:29:35.629: D/ALSAModule(164): setHardwareParams: reqBuffSize 1024 channels 2 sampleRate 48000
12-28 12:29:35.629: D/ALSAModule(164): setHardwareParams: buffer_size 2048, period_size 1024, period_cnt 2
12-28 12:29:35.639: D/NativeNfcTag(923): Check NDEF Failed - status = 3
12-28 12:29:35.639: D/NfcDispatcher(923): dispatch tag: TAG: Tech [android.nfc.tech.NfcV, android.nfc.tech.NdefFormatable] message: null
12-28 12:29:35.669: I/NfcDispatcher(923): no match
根据这一行:“连接到具有不同句柄的技术”我真的担心Android设备永远无法读取该标签..我错了吗?
非常感谢您的帮助
答案 0 :(得分:4)
好的,这是正确的意图过滤器:
<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>