android 5中的android应用程序未读取模拟NFC标记
我使用的是一个NFC屏蔽模型:PN532 RFID/NFC屏蔽,它读取使用HCE主机卡模拟的android手机上模拟的NFC标签。读取标签后,NFC屏蔽模拟标签,以便手机上的应用程序可以读取它。我已经编写了一个android应用程序,它模拟NFC标记并等待NFC标记/消息。这个过程适用于Android 4.4,但不适用于Android 5及更高版本。手机要么看不到NFC shield模拟的标签,要么说它不受支持该标签应该受支持,因为它是一个通用支持的标签 在我的清单中,我有以下意图:android 5中的android应用程序未读取模拟NFC标记,android,arduino,nfc,hce,Android,Arduino,Nfc,Hce,我使用的是一个NFC屏蔽模型:PN532 RFID/NFC屏蔽,它读取使用HCE主机卡模拟的android手机上模拟的NFC标签。读取标签后,NFC屏蔽模拟标签,以便手机上的应用程序可以读取它。我已经编写了一个android应用程序,它模拟NFC标记并等待NFC标记/消息。这个过程适用于Android 4.4,但不适用于Android 5及更高版本。手机要么看不到NFC shield模拟的标签,要么说它不受支持该标签应该受支持,因为它是一个通用支持的标签 在我的清单中,我有以下意图: <i
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
这是正确的还是我需要为android 5及更高版本使用不同的实现?如果您的模拟标记不能正常工作,我建议您发布模拟该标记的相关代码,因此,代码位于Arduino端。我建议使用.and.NfcAdapter.enableForegroundDispatch测试您的“模拟标记”。可能会改变某些内容。。。
mAdapter = NfcAdapter.getDefaultAdapter(this);
pendingIntent = PendingIntent.getActivity(
this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
try {
ndef.addDataType("text/plain"); /* Handles all MIME based dispatches.
You should specify only the ones that you need. */
}
catch (IntentFilter.MalformedMimeTypeException e) {
throw new RuntimeException("fail", e);
}
intentFiltersArray = new IntentFilter[] {ndef, };
this.onNewIntent(this.getIntent());