Language

Ndef.WriteNdefMessageAsync(NdefMessage) Method

Definition

Replaces the tag's NDEF message on a thread-pool thread.

public System.Threading.Tasks.Task WriteNdefMessageAsync(Android.Nfc.NdefMessage? msg);
member this.WriteNdefMessageAsync : Android.Nfc.NdefMessage -> System.Threading.Tasks.Task

Parameters

msg
NdefMessage

The non-null NDEF message to write.

Returns

A task that represents the call to WriteNdefMessage(NdefMessage).

Remarks

This managed wrapper uses Task.Run to call WriteNdefMessage(NdefMessage). Connect first. The tag must be writable and the message must fit its NDEF capacity. Await the task before starting another operation.

If the NFC service dies during the call, the pinned Android implementation logs the RemoteException and returns without throwing it. Task completion alone does not confirm that the message was written in this case.

The method has no cancellation-token parameter. Calling Close() from another thread cancels blocked I/O with IOException. Exceptions from the synchronous call are reported through the task. The NFC permission is required.

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