我在检测空标签时遇到问题。我所说的空标签是指具有NdefRecord.TNF_EMPTY类型记录的Ndef标签。我的应用程序是使用所有标签启动的,但我在处理这类内容时遇到了麻烦。
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED" />
<meta-data android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="@xml/techlist" />
</intent-filter>
<intent-filter >
<action android:name="android.nfc.action.TAG_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>我认为techlist不是问题所在,因为Ndef标签被正确检测到了,不管怎样,我的techlist是这样的
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<tech-list>
<tech>android.nfc.tech.IsoDep</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.NfcA</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.NfcB</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.NfcF</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.NfcV</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.Ndef</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.NdefFormatable</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.MifareClassic</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.MifareUltralight</tech>
</tech-list>
"NFC任务启动器“和”标签“应用程序能够检测到这类内容。
"TagInfo“应用程序检测到该标记为NDEF
Empty record
type: [NULL]
payload length: 0 bytes谢谢。
发布于 2013-02-15 19:54:26
经过几个小时的测试,我已经解决了这个问题,但我不知道为什么会发生这种情况。
问题出在AndroidManifest.xml中的这段代码上
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED" />
<meta-data android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="@xml/techlist" />
</intent-filter>我已将其更改为
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED" />
</intent-filter>
<meta-data android:name="android.nfc.action.TECH_DISCOVERED" android:resource="@xml/techlist" />去掉"meta-data“标签问题就解决了,但是为什么呢?
https://stackoverflow.com/questions/14880530
复制相似问题