Page 1 of 1

Check if NFC capability is present

Posted: Wed Feb 25, 2015 3:15 am
by M&M

hi,

Is there a way to check if NFC hardware exists on a phone? I am not talking about whether NFC is on / off - but to check if NFC exists in the first place. I can use the NFC plugin described in the tutorial but and check if there is an error. But it will generate an error under 2 circumstances I guess- 1) When NFC hardware is not present 2) NFC is turned off.

So how would I know - does NFC exist in the phone (irrespective of whether it is on / off)

Thanks,
M&M


Check if NFC capability is present

Posted: Wed Feb 25, 2015 3:20 am
by M&M

I think I'd try to fit in something like this

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

I have to see how/where to adapt this java code.

Thanks anyway..considered solved ",)

Cheers,
M&M


Check if NFC capability is present

Posted: Wed Feb 25, 2015 6:25 am
by Maryna Brodina

Thank you for update!