Udostępnij za pośrednictwem


NfcF.Transceive(Byte[]) Method

Definition

Send raw NFC-F commands to the tag and receive the response.

[Android.Runtime.Register("transceive", "([B)[B", "")]
public byte[]? Transceive (byte[]? data);
[<Android.Runtime.Register("transceive", "([B)[B", "")>]
member this.Transceive : byte[] -> byte[]

Parameters

data
Byte[]

bytes to send

Returns

Byte[]

bytes received in response

Attributes

Exceptions

if there is an I/O failure, or this operation is canceled

Remarks

Send raw NFC-F commands to the tag and receive the response.

Applications must not prefix the SoD (preamble and sync code) and/or append the EoD (CRC) to the payload, it will be automatically calculated.

A typical NFC-F frame for this method looks like:

LENGTH (1 byte) --- CMD (1 byte) -- IDm (8 bytes) -- PARAMS (LENGTH - 10 bytes)

Use #getMaxTransceiveLength to retrieve the maximum amount of bytes that can be sent with #transceive.

This is an I/O operation and will block until complete. It must not be called from the main application thread. A blocked call will be canceled with IOException if #close is called from another thread.

<p class="note">Requires the android.Manifest.permission#NFC permission.

Java documentation for android.nfc.tech.NfcF.transceive(byte[]).

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