Share via


NfcAdapter.Enable Method

Definition

Enable NFC hardware.

[Android.Runtime.Register("enable", "()Z", "", ApiSince=36)]
[Android.Runtime.RequiresPermission("android.permission.WRITE_SECURE_SETTINGS")]
public bool Enable();
[<Android.Runtime.Register("enable", "()Z", "", ApiSince=36)>]
[<Android.Runtime.RequiresPermission("android.permission.WRITE_SECURE_SETTINGS")>]
member this.Enable : unit -> bool

Returns

Attributes

Remarks

Enable NFC hardware.

This call is asynchronous. Listen for #ACTION_ADAPTER_STATE_CHANGED broadcasts to find out when the operation is complete.

This API is only allowed to be called by system apps or apps which are Device Owner or Profile Owner.

If this returns true, then either NFC is already on, or a #ACTION_ADAPTER_STATE_CHANGED broadcast will be sent to indicate a state transition. If this returns false, then there is some problem that prevents an attempt to turn NFC on (for example we are in airplane mode and NFC is not toggleable in airplane mode on this platform).

Java documentation for android.nfc.NfcAdapter.enable().

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