Compartir a través de


NfcAdapter.GetDefaultAdapter(Context) Method

Definition

Helper to get the default NFC Adapter.

[Android.Runtime.Register("getDefaultAdapter", "(Landroid/content/Context;)Landroid/nfc/NfcAdapter;", "")]
public static Android.Nfc.NfcAdapter? GetDefaultAdapter (Android.Content.Context? context);
[<Android.Runtime.Register("getDefaultAdapter", "(Landroid/content/Context;)Landroid/nfc/NfcAdapter;", "")>]
static member GetDefaultAdapter : Android.Content.Context -> Android.Nfc.NfcAdapter

Parameters

context
Context

the calling application's context

Returns

the default NFC adapter, or null if no NFC adapter exists

Attributes

Remarks

Helper to get the default NFC Adapter.

Most Android devices will only have one NFC Adapter (NFC Controller).

This helper is the equivalent of:

NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE);
            NfcAdapter adapter = manager.getDefaultAdapter();

Java documentation for android.nfc.NfcAdapter.getDefaultAdapter(android.content.Context).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to