我使用在 VirtualBox 下运行的 Android 4.4 并连接了 ACR122U NFC 阅读器。
我在清单中添加了几行:
<uses-permission android:name="android.permission.NFC" />
<uses-feature android:name="android.hardware.nfc" android:required="true" />
和:
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
并尝试通过以下方式检查 NFC 阅读器
nfcAdapter = NfcAdapter.getDefaultAdapter(this);
if(nfcAdapter == null) {
Toast.makeText(this, "NFC NOT supported on this devices!", Toast.LENGTH_LONG).show();
但收到不支持 NFC 的消息。我在哪里做错了?