NdefMessage Constructors

Definition

Overloads

NdefMessage(NdefRecord[])

Construct an NDEF Message from one or more NDEF Records.

NdefMessage(Byte[])

Construct an NDEF Message by parsing raw bytes.

NdefMessage(NdefRecord, NdefRecord[])

Construct an NDEF Message from one or more NDEF Records.

NdefMessage(NdefRecord[])

Construct an NDEF Message from one or more NDEF Records.

[Android.Runtime.Register(".ctor", "([Landroid/nfc/NdefRecord;)V", "")]
public NdefMessage (Android.Nfc.NdefRecord[]? records);
[<Android.Runtime.Register(".ctor", "([Landroid/nfc/NdefRecord;)V", "")>]
new Android.Nfc.NdefMessage : Android.Nfc.NdefRecord[] -> Android.Nfc.NdefMessage

Parameters

records
NdefRecord[]

one or more records

Attributes

Remarks

Construct an NDEF Message from one or more NDEF Records.

Java documentation for android.nfc.NdefMessage.NdefMessage(android.nfc.NdefRecord[]).

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

NdefMessage(Byte[])

Construct an NDEF Message by parsing raw bytes.

[Android.Runtime.Register(".ctor", "([B)V", "")]
public NdefMessage (byte[]? data);
[<Android.Runtime.Register(".ctor", "([B)V", "")>]
new Android.Nfc.NdefMessage : byte[] -> Android.Nfc.NdefMessage

Parameters

data
Byte[]

raw bytes to parse

Attributes

Exceptions

if the data cannot be parsed

Remarks

Construct an NDEF Message by parsing raw bytes.

Strict validation of the NDEF binary structure is performed: there must be at least one record, every record flag must be correct, and the total length of the message must match the length of the input data.

This parser can handle chunked records, and converts them into logical NdefRecords within the message.

Once the input data has been parsed to one or more logical records, basic validation of the tnf, type, id, and payload fields of each record is performed, as per the documentation on on NdefRecord#NdefRecord(short, byte[], byte[], byte[])

If either strict validation of the binary format fails, or basic validation during record construction fails, a FormatException is thrown

Deep inspection of the type, id and payload fields of each record is not performed, so it is possible to parse input that has a valid binary format and confirms to the basic validation requirements of NdefRecord#NdefRecord(short, byte[], byte[], byte[]), but fails more strict requirements as specified by the NFC Forum.

<p class="note"> It is safe to re-use the data byte array after construction: this constructor will make an internal copy of all necessary fields.

Java documentation for android.nfc.NdefMessage.NdefMessage(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

NdefMessage(NdefRecord, NdefRecord[])

Construct an NDEF Message from one or more NDEF Records.

[Android.Runtime.Register(".ctor", "(Landroid/nfc/NdefRecord;[Landroid/nfc/NdefRecord;)V", "")]
public NdefMessage (Android.Nfc.NdefRecord? record, params Android.Nfc.NdefRecord[]? records);
[<Android.Runtime.Register(".ctor", "(Landroid/nfc/NdefRecord;[Landroid/nfc/NdefRecord;)V", "")>]
new Android.Nfc.NdefMessage : Android.Nfc.NdefRecord * Android.Nfc.NdefRecord[] -> Android.Nfc.NdefMessage

Parameters

record
NdefRecord

first record (mandatory)

records
NdefRecord[]

additional records (optional)

Attributes

Remarks

Java documentation for android.nfc.NdefMessage.NdefMessage(android.nfc.NdefRecord, android.nfc.NdefRecord).

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