다음을 통해 공유


NfcAdapter Class

Definition

Represents the local NFC adapter.

[Android.Runtime.Register("android/nfc/NfcAdapter", DoNotGenerateAcw=true)]
public sealed class NfcAdapter : Java.Lang.Object
[<Android.Runtime.Register("android/nfc/NfcAdapter", DoNotGenerateAcw=true)>]
type NfcAdapter = class
    inherit Object
Inheritance
NfcAdapter
Attributes

Remarks

Represents the local NFC adapter.

Use the helper #getDefaultAdapter(Context) to get the default NFC adapter for this Android device.

<div class="special reference"> <h3>Developer Guides</h3>

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

To perform basic file sharing between devices, read Sharing Files with NFC. </div>

Java documentation for android.nfc.NfcAdapter.

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.

Fields

ActionAdapterStateChanged

Broadcast Action: The state of the local NFC adapter has been changed.

ActionNdefDiscovered

Intent to start an activity when a tag with NDEF payload is discovered.

ActionPreferredPaymentChanged

Broadcast Action: Intent to notify if the preferred payment service changed.

ActionTagDiscovered

Intent to start an activity when a tag is discovered.

ActionTechDiscovered

Intent to start an activity when a tag is discovered and activities are registered for the specific technologies on the tag.

ActionTransactionDetected

Broadcast Action: Intent to notify an application that a transaction event has occurred on the Secure Element.

ExtraAdapterState

Used as an int extra field in #ACTION_ADAPTER_STATE_CHANGED intents to request the current power state.

ExtraAid

Mandatory byte[] extra field in #ACTION_TRANSACTION_DETECTED

ExtraData

Optional byte[] extra field in #ACTION_TRANSACTION_DETECTED

ExtraId

Optional extra containing a byte array containing the ID of the discovered tag for the #ACTION_NDEF_DISCOVERED, #ACTION_TECH_DISCOVERED, and #ACTION_TAG_DISCOVERED intents.

ExtraNdefMessages

Extra containing an array of NdefMessage present on the discovered tag.

ExtraPreferredPaymentChangedReason

Mandatory String extra field in #ACTION_PREFERRED_PAYMENT_CHANGED Indicates the condition when trigger this event.

ExtraReaderPresenceCheckDelay

Int Extra for use with #enableReaderMode(Activity, ReaderCallback, int, Bundle).

ExtraSecureElementName

Mandatory String extra field in #ACTION_TRANSACTION_DETECTED Indicates the Secure Element on which the transaction occurred.

ExtraTag

Mandatory extra containing the Tag that was discovered for the #ACTION_NDEF_DISCOVERED, #ACTION_TECH_DISCOVERED, and #ACTION_TAG_DISCOVERED intents.

FlagReaderNfcA
Obsolete.

Flag for use with #enableReaderMode(Activity, ReaderCallback, int, Bundle).

FlagReaderNfcB
Obsolete.

Flag for use with #enableReaderMode(Activity, ReaderCallback, int, Bundle).

FlagReaderNfcBarcode
Obsolete.

Flag for use with #enableReaderMode(Activity, ReaderCallback, int, Bundle).

FlagReaderNfcF
Obsolete.

Flag for use with #enableReaderMode(Activity, ReaderCallback, int, Bundle).

FlagReaderNfcV
Obsolete.

Flag for use with #enableReaderMode(Activity, ReaderCallback, int, Bundle).

FlagReaderNoPlatformSounds
Obsolete.

Flag for use with #enableReaderMode(Activity, ReaderCallback, int, Bundle).

FlagReaderSkipNdefCheck
Obsolete.

Flag for use with #enableReaderMode(Activity, ReaderCallback, int, Bundle).

PreferredPaymentChanged
Obsolete.

User selected another payment application as the preferred payment.

PreferredPaymentLoaded
Obsolete.

Nfc is enabled and the preferred payment aids are registered.

PreferredPaymentUpdated
Obsolete.

Current preferred payment has issued an update (registered/unregistered new aids or has been updated itself).

StateOff
StateOn
StateTurningOff
StateTurningOn

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
DefaultAdapter
Obsolete.

Legacy NfcAdapter getter, always use #getDefaultAdapter(Context) instead.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsEnabled

Return true if this NFC Adapter has any features enabled.

IsNdefPushEnabled

Return true if the NDEF Push (Android Beam) feature is enabled.

IsSecureNfcEnabled

Checks Secure NFC feature is enabled.

IsSecureNfcSupported

Checks if the device supports Secure NFC functionality.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
NfcAntennaInfo

Returns information regarding Nfc antennas on the device such as their relative positioning on the device.

PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
DisableForegroundDispatch(Activity)

Disable foreground dispatch to the given activity.

DisableForegroundNdefPush(Activity)
Obsolete.

Disable NDEF message push over P2P.

DisableReaderMode(Activity)

Restore the NFC adapter to normal mode of operation: supporting peer-to-peer (Android Beam), card emulation, and polling for all supported tag technologies.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
EnableForegroundDispatch(Activity, PendingIntent, IntentFilter[], String[][])

Enable foreground dispatch to the given Activity.

EnableForegroundNdefPush(Activity, NdefMessage)
Obsolete.

Enable NDEF message push over NFC while this Activity is in the foreground.

EnableReaderMode(Activity, NfcAdapter+IReaderCallback, NfcReaderFlags, Bundle)

Limit the NFC controller to reader mode while this Activity is in the foreground.

Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetDefaultAdapter(Context)

Helper to get the default NFC Adapter.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
Ignore(Tag, Int32, NfcAdapter+IOnTagRemovedListener, Handler)

Signals that you are no longer interested in communicating with an NFC tag for as long as it remains in range.

InvokeBeam(Activity)

Manually invoke Android Beam to share data.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetBeamPushUris(Uri[], Activity)

Set one or more Uris to send using Android Beam (TM).

SetBeamPushUrisCallback(NfcAdapter+ICreateBeamUrisCallback, Activity)

Set a callback that will dynamically generate one or more Uris to send using Android Beam (TM).

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetNdefPushMessage(NdefMessage, Activity, Activity[])
SetNdefPushMessageCallback(NfcAdapter+ICreateNdefMessageCallback, Activity, Activity[])
SetOnNdefPushCompleteCallback(NfcAdapter+IOnNdefPushCompleteCallback, Activity, Activity[])

Set a callback on successful Android Beam (TM).

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to