检查设备是否支持 NFC 并且已启用 - Android

Create a check that the device supports NFC and it is enabled - Android

检查设备是否支持 NFC 且已启用的条件。

调用系统服务检测,示例代码:

NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE);
NfcAdapter adapter = manager.getDefaultAdapter();
if (adapter != null && adapter.isEnabled()) {
   //support NFC
}else{
   //doesn't support NFC
}