我一直在很好地使用 NFC,并且对结果非常满意。
我现在的问题是如何处理写在标签上的 vCard?
我已经在 list 中设置了这些行:
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<data android:mimeType="text/vcard" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
但似乎没用:每次我扫描标签时,联系人应用程序都会打开。
非常感谢您提供任何链接或建议!
最佳答案
您应该过滤两者text/vcard和text/x-vcard:
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/vcard" />
<data android:mimeType="text/x-vcard" />
</intent-filter>
我已经看到两者都被用于 NFC 标签。根据Wikipedia , text/x-vcard 已弃用。
关于android - NFC:如何告诉我的应用程序打开 vCard 而不是联系人应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13001176/