Dela via


ActivityOptions.SetShareIdentityEnabled(Boolean) Method

Definition

Sets whether the identity of the launching app should be shared with the activity.

[Android.Runtime.Register("setShareIdentityEnabled", "(Z)Landroid/app/ActivityOptions;", "GetSetShareIdentityEnabled_ZHandler", ApiSince=34)]
public virtual Android.App.ActivityOptions SetShareIdentityEnabled (bool shareIdentity);
[<Android.Runtime.Register("setShareIdentityEnabled", "(Z)Landroid/app/ActivityOptions;", "GetSetShareIdentityEnabled_ZHandler", ApiSince=34)>]
abstract member SetShareIdentityEnabled : bool -> Android.App.ActivityOptions
override this.SetShareIdentityEnabled : bool -> Android.App.ActivityOptions

Parameters

shareIdentity
Boolean

whether the launching app's identity should be shared with the activity

Returns

this ActivityOptions instance.

Attributes

Remarks

Sets whether the identity of the launching app should be shared with the activity.

Use this option when starting an activity that needs to know the identity of the launching app; with this set to true, the activity will have access to the launching app's package name and uid.

Defaults to false if not set.

Note, even if the launching app does not explicitly enable sharing of its identity, if the activity is started with Activity#startActivityForResult, then Activity#getCallingPackage() will still return the launching app's package name to allow validation of the result's recipient. Also, an activity running within a package signed by the same key used to sign the platform (some system apps such as Settings will be signed with the platform's key) will have access to the launching app's identity.

Java documentation for android.app.ActivityOptions.setShareIdentityEnabled(boolean).

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