M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

Check if NFC capability is present

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

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

Check if NFC capability is present

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Check if NFC capability is present

Thank you for update!

Return to “Issues”