Android NFC
1. 确认nfc是否可用
NfcManager manager = (NfcManager) Context.getSystemService(Context.NFC_SERVICE); NfcAdapter adapter = manager.getDefaultAdapter(); if (adapter != null && adapter.isEnabled()) { // adapter exists and is enabled. System.out.println("can"); }else{ System.out.println("can't"); // }
2. 如果NFC 没有open,从程序中进入NFC设置界面
startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));
note:不能再程序中打开和关闭NFC设置,SDK api 没有提供接口。