CrossProfileApps.StartMainActivity(ComponentName, UserHandle) Method

Definition

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

[Android.Runtime.Register("startMainActivity", "(Landroid/content/ComponentName;Landroid/os/UserHandle;)V", "GetStartMainActivity_Landroid_content_ComponentName_Landroid_os_UserHandle_Handler", ApiSince=28)]
public virtual void StartMainActivity (Android.Content.ComponentName component, Android.OS.UserHandle targetUser);
[<Android.Runtime.Register("startMainActivity", "(Landroid/content/ComponentName;Landroid/os/UserHandle;)V", "GetStartMainActivity_Landroid_content_ComponentName_Landroid_os_UserHandle_Handler", ApiSince=28)>]
abstract member StartMainActivity : Android.Content.ComponentName * Android.OS.UserHandle -> unit
override this.StartMainActivity : Android.Content.ComponentName * Android.OS.UserHandle -> unit

Parameters

component
ComponentName

The ComponentName of the activity to launch, it must be exported and has action android.content.Intent#ACTION_MAIN, category android.content.Intent#CATEGORY_LAUNCHER. Otherwise, SecurityException will be thrown.

targetUser
UserHandle

The UserHandle of the profile, must be one of the users returned by #getTargetUserProfiles(), otherwise a SecurityException will be thrown.

Attributes

Remarks

Java documentation for android.content.pm.CrossProfileApps.startMainActivity(android.content.ComponentName, android.os.UserHandle).

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