FileDocCategorySizeDatePackage
NfcManager.javaAPI DocAndroid 5.1 API2226Thu Mar 12 22:22:10 GMT 2015android.nfc

NfcManager

public final class NfcManager extends Object
High level manager used to obtain an instance of an {@link NfcAdapter}.

Use {@link android.content.Context#getSystemService(java.lang.String)} with {@link Context#NFC_SERVICE} to create an {@link NfcManager}, then call {@link #getDefaultAdapter} to obtain the {@link NfcAdapter}.

Alternately, you can just call the static helper {@link NfcAdapter#getDefaultAdapter(android.content.Context)}.

Developer Guides

For more information about using NFC, read the Near Field Communication developer guide.

see
Context#getSystemService
see
NfcAdapter#getDefaultAdapter(android.content.Context)

Fields Summary
private final NfcAdapter
mAdapter
Constructors Summary
public NfcManager(android.content.Context context)

hide

        NfcAdapter adapter;
        context = context.getApplicationContext();
        if (context == null) {
            throw new IllegalArgumentException(
                    "context not associated with any application (using a mock context?)");
        }
        try {
            adapter = NfcAdapter.getNfcAdapter(context);
        } catch (UnsupportedOperationException e) {
            adapter = null;
        }
        mAdapter = adapter;
    
Methods Summary
public NfcAdaptergetDefaultAdapter()
Get the default NFC Adapter for this device.

return
the default NFC Adapter

        return mAdapter;