How to check whether NFC is enabled or not in android?

后端 未结 5 1240
走了就别回头了
走了就别回头了 2020-12-25 12:09

How can i check whether NFC is enabled or not programmatically? Is there any way to enable the NFC on the device from my program? Please help me

5条回答
  •  情深已故
    2020-12-25 13:04

    Use PackageManager and hasSystemFeature("android.hardware.nfc"), matching the element you should have in your manifest.

    Since 2.3.3 you can also use NfcAdapter.getDefaultAdapter() to get the adapter (if available) and call its isEnabled() method to check whether NFC is currently turned on.

提交回复
热议问题