Compartilhar via


LauncherApps.IsActivityEnabled(ComponentName, UserHandle) Method

Definition

Checks if the activity exists and it enabled for a profile.

[Android.Runtime.Register("isActivityEnabled", "(Landroid/content/ComponentName;Landroid/os/UserHandle;)Z", "GetIsActivityEnabled_Landroid_content_ComponentName_Landroid_os_UserHandle_Handler")]
public virtual bool IsActivityEnabled (Android.Content.ComponentName? component, Android.OS.UserHandle? user);
[<Android.Runtime.Register("isActivityEnabled", "(Landroid/content/ComponentName;Landroid/os/UserHandle;)Z", "GetIsActivityEnabled_Landroid_content_ComponentName_Landroid_os_UserHandle_Handler")>]
abstract member IsActivityEnabled : Android.Content.ComponentName * Android.OS.UserHandle -> bool
override this.IsActivityEnabled : Android.Content.ComponentName * Android.OS.UserHandle -> bool

Parameters

component
ComponentName

The activity to check.

user
UserHandle

The UserHandle of the profile.

Returns

true if the activity exists and is enabled.

Attributes

Remarks

Checks if the activity exists and it enabled for a profile.

The activity may still not be exported, in which case #startMainActivity will throw a SecurityException unless the caller has the same UID as the target app's.

If the user in question is a hidden profile UserManager.USER_TYPE_PROFILE_PRIVATE, caller should have either:

<ul> <li>the privileged android.Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL permission</li> <li>the normal android.Manifest.permission.ACCESS_HIDDEN_PROFILES permission and the android.app.role.RoleManager.ROLE_HOME role. </li> </ul>

Java documentation for android.content.pm.LauncherApps.isActivityEnabled(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