Language

Ndef.MakeReadOnlyAsync Method

Definition

Makes the tag read-only on a thread-pool thread.

public System.Threading.Tasks.Task<bool> MakeReadOnlyAsync();
member this.MakeReadOnlyAsync : unit -> System.Threading.Tasks.Task<bool>

Returns

A task whose result is true if the tag was made read-only; otherwise, false if the operation could not make it read-only.

Remarks

This managed wrapper uses Task.Run to call MakeReadOnly(). Connect first and await the task before starting another operation. The operation marks the tag read-only and, where possible, sets permanent lock bits. This change cannot be reversed. A false result is not a guarantee that a retry will succeed; the Android implementation also returns false when the NFC service is unavailable.

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