Language

MifareUltralight.WritePageAsync(Int32, Byte[]) Method

Definition

Writes one four-byte page to the tag on a thread-pool thread.

public System.Threading.Tasks.Task WritePageAsync(int pageOffset, byte[]? data);
member this.WritePageAsync : int * byte[] -> System.Threading.Tasks.Task

Parameters

pageOffset
Int32

The zero-based index of the page to write, from 0 through 255. The page must be writable on the tag.

data
Byte[]

The four bytes to write.

Returns

A task that represents the page write operation.

Remarks

This managed wrapper uses Task.Run to call WritePage(Int32, Byte[]). Connect first and await the task before starting another operation. Supply exactly four data bytes as required by the page-write protocol.

The pinned Android implementation checks the page index but does not check the array length before sending the command. The four-byte size is a protocol requirement, not a length check supplied by this wrapper.

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