Language

NfcA.TransceiveAsync(Byte[]) Method

Definition

Sends NFC-A commands to the tag and receives its response on a thread-pool thread.

public System.Threading.Tasks.Task<byte[]?> TransceiveAsync(byte[]? data);
member this.TransceiveAsync : byte[] -> System.Threading.Tasks.Task<byte[]>

Parameters

data
Byte[]

The complete NFC-A command bytes to send, without the CRC. The length must not exceed MaxTransceiveLength.

Returns

Task<Byte[]>

A task whose result contains the response bytes.

Remarks

This managed wrapper uses Task.Run to call Transceive(Byte[]). Connect first and await the task before starting another operation. Android calculates the CRC. Commands must contain complete bytes; a partial-byte command such as SENS_REQ is not supported.

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