Sdílet prostřednictvím


NfcAdapter.ICreateNdefMessageCallback.CreateNdefMessage(NfcEvent) Method

Definition

Called to provide a NdefMessage to push.

[Android.Runtime.Register("createNdefMessage", "(Landroid/nfc/NfcEvent;)Landroid/nfc/NdefMessage;", "GetCreateNdefMessage_Landroid_nfc_NfcEvent_Handler:Android.Nfc.NfcAdapter/ICreateNdefMessageCallbackInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Android.Nfc.NdefMessage? CreateNdefMessage (Android.Nfc.NfcEvent? e);
[<Android.Runtime.Register("createNdefMessage", "(Landroid/nfc/NfcEvent;)Landroid/nfc/NdefMessage;", "GetCreateNdefMessage_Landroid_nfc_NfcEvent_Handler:Android.Nfc.NfcAdapter/ICreateNdefMessageCallbackInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member CreateNdefMessage : Android.Nfc.NfcEvent -> Android.Nfc.NdefMessage

Parameters

e
NfcEvent

NfcEvent with the NfcAdapter field set

Returns

NDEF message to push, or null to not provide a message

Attributes

Remarks

Called to provide a NdefMessage to push.

This callback is usually made on a binder thread (not the UI thread).

Called when this device is in range of another device that might support NDEF push. It allows the application to create the NDEF message only when it is required.

NDEF push cannot occur until this method returns, so do not block for too long.

The Android operating system will usually show a system UI on top of your activity during this time, so do not try to request input from the user to complete the callback, or provide custom NDEF push UI. The user probably will not see it.

Java documentation for android.nfc.NfcAdapter.CreateNdefMessageCallback.createNdefMessage(android.nfc.NfcEvent).

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