Udostępnij za pośrednictwem


NdefRecord.CreateUri Method

Definition

Overloads

CreateUri(Uri)

Create a new NDEF Record containing a URI.

CreateUri(String)

Create a new NDEF Record containing a URI.

CreateUri(Uri)

Create a new NDEF Record containing a URI.

[Android.Runtime.Register("createUri", "(Landroid/net/Uri;)Landroid/nfc/NdefRecord;", "")]
public static Android.Nfc.NdefRecord? CreateUri (Android.Net.Uri? uri);
[<Android.Runtime.Register("createUri", "(Landroid/net/Uri;)Landroid/nfc/NdefRecord;", "")>]
static member CreateUri : Android.Net.Uri -> Android.Nfc.NdefRecord

Parameters

uri
Uri

URI to encode.

Returns

an NDEF Record containing the URI

Attributes

Remarks

Create a new NDEF Record containing a URI.

Use this method to encode a URI (or URL) into an NDEF Record.

Uses the well known URI type representation: #TNF_WELL_KNOWN and #RTD_URI. This is the most efficient encoding of a URI into NDEF.

The uri parameter will be normalized with Uri#normalizeScheme to set the scheme to lower case to follow Android best practices for intent filtering. However the unchecked exception IllegalArgumentException may be thrown if the uri parameter has serious problems, for example if it is empty, so always catch this exception if you are passing user-generated data into this method.

Reference specification: NFCForum-TS-RTD_URI_1.0

Java documentation for android.nfc.NdefRecord.createUri(android.net.Uri).

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

CreateUri(String)

Create a new NDEF Record containing a URI.

[Android.Runtime.Register("createUri", "(Ljava/lang/String;)Landroid/nfc/NdefRecord;", "")]
public static Android.Nfc.NdefRecord? CreateUri (string? uriString);
[<Android.Runtime.Register("createUri", "(Ljava/lang/String;)Landroid/nfc/NdefRecord;", "")>]
static member CreateUri : string -> Android.Nfc.NdefRecord

Parameters

uriString
String

string URI to encode.

Returns

an NDEF Record containing the URI

Attributes

Remarks

Create a new NDEF Record containing a URI.

Use this method to encode a URI (or URL) into an NDEF Record.

Uses the well known URI type representation: #TNF_WELL_KNOWN and #RTD_URI. This is the most efficient encoding of a URI into NDEF.

The uriString parameter will be normalized with Uri#normalizeScheme to set the scheme to lower case to follow Android best practices for intent filtering. However the unchecked exception IllegalArgumentException may be thrown if the uriString parameter has serious problems, for example if it is empty, so always catch this exception if you are passing user-generated data into this method.

Reference specification: NFCForum-TS-RTD_URI_1.0

Java documentation for android.nfc.NdefRecord.createUri(java.lang.String).

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