Compartir a través de


PackageManager.SetComponentEnabledSetting Method

Definition

Set the enabled setting for a package component (activity, receiver, service, provider).

[Android.Runtime.Register("setComponentEnabledSetting", "(Landroid/content/ComponentName;II)V", "GetSetComponentEnabledSetting_Landroid_content_ComponentName_IIHandler")]
[Android.Runtime.RequiresPermission("android.permission.CHANGE_COMPONENT_ENABLED_STATE")]
public abstract void SetComponentEnabledSetting (Android.Content.ComponentName componentName, Android.Content.PM.ComponentEnabledState newState, Android.Content.PM.ComponentEnableOption flags);
[<Android.Runtime.Register("setComponentEnabledSetting", "(Landroid/content/ComponentName;II)V", "GetSetComponentEnabledSetting_Landroid_content_ComponentName_IIHandler")>]
[<Android.Runtime.RequiresPermission("android.permission.CHANGE_COMPONENT_ENABLED_STATE")>]
abstract member SetComponentEnabledSetting : Android.Content.ComponentName * Android.Content.PM.ComponentEnabledState * Android.Content.PM.ComponentEnableOption -> unit

Parameters

componentName
ComponentName

The component to enable

newState
ComponentEnabledState

The new enabled state for the component.

flags
ComponentEnableOption

Optional behavior flags.

Attributes

Remarks

Set the enabled setting for a package component (activity, receiver, service, provider). This setting will override any enabled state which may have been set by the component in its manifest.

Consider using #setComponentEnabledSettings(List) if multiple components need to be updated atomically.

Java documentation for android.content.pm.PackageManager.setComponentEnabledSetting(android.content.ComponentName, int, int).

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