Partager via


Intent.SetIdentifier(String) Method

Definition

Set an identifier for this Intent.

[Android.Runtime.Register("setIdentifier", "(Ljava/lang/String;)Landroid/content/Intent;", "GetSetIdentifier_Ljava_lang_String_Handler", ApiSince=29)]
public virtual Android.Content.Intent SetIdentifier (string? identifier);
[<Android.Runtime.Register("setIdentifier", "(Ljava/lang/String;)Landroid/content/Intent;", "GetSetIdentifier_Ljava_lang_String_Handler", ApiSince=29)>]
abstract member SetIdentifier : string -> Android.Content.Intent
override this.SetIdentifier : string -> Android.Content.Intent

Parameters

identifier
String

The identifier for this Intent. The contents of the string have no meaning to the system, except whether they are exactly the same as another identifier.

Returns

Returns the same Intent object, for chaining multiple calls into a single statement.

Attributes

Remarks

Set an identifier for this Intent. If set, this provides a unique identity for this Intent, allowing it to be unique from other Intents that would otherwise look the same. In particular, this will be used by #filterEquals(Intent) to determine if two Intents are the same as with other fields like #setAction. However, unlike those fields, the identifier is <em>never</em> used for matching against an IntentFilter; it is as if the identifier has not been set on the Intent.

This can be used, for example, to make this Intent unique from other Intents that are otherwise the same, for use in creating a android.app.PendingIntent. (Be aware however that the receiver of the PendingIntent will see whatever you put in here.) The structure of this string is completely undefined by the platform, however if you are going to be exposing identifier strings across different applications you may need to define your own structure if there is no central party defining the contents of this field.

Java documentation for android.content.Intent.setIdentifier(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