Share via


CrossProfileApps.StartActivity Method

Definition

Overloads

StartActivity(Intent, UserHandle, Activity)

Starts the specified activity of the caller package in the specified profile.

StartActivity(Intent, UserHandle, Activity, Bundle)

Starts the specified activity of the caller package in the specified profile.

StartActivity(Intent, UserHandle, Activity)

Starts the specified activity of the caller package in the specified profile.

[Android.Runtime.Register("startActivity", "(Landroid/content/Intent;Landroid/os/UserHandle;Landroid/app/Activity;)V", "GetStartActivity_Landroid_content_Intent_Landroid_os_UserHandle_Landroid_app_Activity_Handler", ApiSince=30)]
public virtual void StartActivity (Android.Content.Intent intent, Android.OS.UserHandle targetUser, Android.App.Activity? callingActivity);
[<Android.Runtime.Register("startActivity", "(Landroid/content/Intent;Landroid/os/UserHandle;Landroid/app/Activity;)V", "GetStartActivity_Landroid_content_Intent_Landroid_os_UserHandle_Landroid_app_Activity_Handler", ApiSince=30)>]
abstract member StartActivity : Android.Content.Intent * Android.OS.UserHandle * Android.App.Activity -> unit
override this.StartActivity : Android.Content.Intent * Android.OS.UserHandle * Android.App.Activity -> unit

Parameters

intent
Intent

The intent to launch. A component in the caller package must be specified.

targetUser
UserHandle

The UserHandle of the profile; must be one of the users returned by #getTargetUserProfiles() if different to the calling user, otherwise a SecurityException will be thrown.

callingActivity
Activity

The activity to start the new activity from for the purposes of passing back any result and deciding which task the new activity should belong to. If null, the activity will always be started in a new task and no result will be returned.

Attributes

Remarks

Starts the specified activity of the caller package in the specified profile.

The caller must have the android.Manifest.permission#INTERACT_ACROSS_PROFILES, android.Manifest.permission#INTERACT_ACROSS_USERS, or android.Manifest.permission#INTERACT_ACROSS_USERS_FULL permission. Both the caller and target user profiles must be in the same profile group. The target user must be a valid user returned from #getTargetUserProfiles().

Java documentation for android.content.pm.CrossProfileApps.startActivity(android.content.Intent, android.os.UserHandle, android.app.Activity).

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

StartActivity(Intent, UserHandle, Activity, Bundle)

Starts the specified activity of the caller package in the specified profile.

[Android.Runtime.Register("startActivity", "(Landroid/content/Intent;Landroid/os/UserHandle;Landroid/app/Activity;Landroid/os/Bundle;)V", "GetStartActivity_Landroid_content_Intent_Landroid_os_UserHandle_Landroid_app_Activity_Landroid_os_Bundle_Handler", ApiSince=30)]
public virtual void StartActivity (Android.Content.Intent intent, Android.OS.UserHandle targetUser, Android.App.Activity? callingActivity, Android.OS.Bundle? options);
[<Android.Runtime.Register("startActivity", "(Landroid/content/Intent;Landroid/os/UserHandle;Landroid/app/Activity;Landroid/os/Bundle;)V", "GetStartActivity_Landroid_content_Intent_Landroid_os_UserHandle_Landroid_app_Activity_Landroid_os_Bundle_Handler", ApiSince=30)>]
abstract member StartActivity : Android.Content.Intent * Android.OS.UserHandle * Android.App.Activity * Android.OS.Bundle -> unit
override this.StartActivity : Android.Content.Intent * Android.OS.UserHandle * Android.App.Activity * Android.OS.Bundle -> unit

Parameters

intent
Intent

The intent to launch. A component in the caller package must be specified.

targetUser
UserHandle

The UserHandle of the profile; must be one of the users returned by #getTargetUserProfiles() if different to the calling user, otherwise a SecurityException will be thrown.

callingActivity
Activity

The activity to start the new activity from for the purposes of passing back any result and deciding which task the new activity should belong to. If null, the activity will always be started in a new task and no result will be returned.

options
Bundle

The activity options or null. See android.app.ActivityOptions.

Attributes

Remarks

Starts the specified activity of the caller package in the specified profile.

The caller must have the android.Manifest.permission#INTERACT_ACROSS_PROFILES, android.Manifest.permission#INTERACT_ACROSS_USERS, or android.Manifest.permission#INTERACT_ACROSS_USERS_FULL permission. Both the caller and target user profiles must be in the same profile group. The target user must be a valid user returned from #getTargetUserProfiles().

Java documentation for android.content.pm.CrossProfileApps.startActivity(android.content.Intent, android.os.UserHandle, android.app.Activity, android.os.Bundle).

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