Udostępnij za pośrednictwem


NdefFormatable.Format(NdefMessage) Method

Definition

Format a tag as NDEF, and write a NdefMessage.

[Android.Runtime.Register("format", "(Landroid/nfc/NdefMessage;)V", "")]
public void Format (Android.Nfc.NdefMessage? firstMessage);
[<Android.Runtime.Register("format", "(Landroid/nfc/NdefMessage;)V", "")>]
member this.Format : Android.Nfc.NdefMessage -> unit

Parameters

firstMessage
NdefMessage

the NDEF message to write after formatting, can be null

Attributes

Exceptions

if the tag leaves the field

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

if the NDEF Message to write is malformed

Remarks

Format a tag as NDEF, and write a NdefMessage.

This is a multi-step process, an IOException is thrown if any one step fails.

The card is left in a read-write state after this operation.

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.NdefFormatable.format(android.nfc.NdefMessage).

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