Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

android

nfc

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

like image 206
Santhosh Avatar asked Oct 01 '11 06:10

Santhosh


1 Answers

NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE); NfcAdapter adapter = manager.getDefaultAdapter(); if (adapter != null && adapter.isEnabled()) {     // adapter exists and is enabled. } 

You cannot enable the NFC programmatically. The user has to do it manually through settings or hardware button.

like image 146
Ronnie Avatar answered Sep 22 '22 00:09

Ronnie