Freigeben über


PackageManager.SetComponentEnabledSettings Method

Definition

Set the enabled settings for package components such as activities, receivers, services and providers.

[Android.Runtime.Register("setComponentEnabledSettings", "(Ljava/util/List;)V", "GetSetComponentEnabledSettings_Ljava_util_List_Handler", ApiSince=33)]
[Android.Runtime.RequiresPermission("android.permission.CHANGE_COMPONENT_ENABLED_STATE")]
public virtual void SetComponentEnabledSettings (System.Collections.Generic.IList<Android.Content.PM.PackageManager.ComponentEnabledSetting> settings);
[<Android.Runtime.Register("setComponentEnabledSettings", "(Ljava/util/List;)V", "GetSetComponentEnabledSettings_Ljava_util_List_Handler", ApiSince=33)>]
[<Android.Runtime.RequiresPermission("android.permission.CHANGE_COMPONENT_ENABLED_STATE")>]
abstract member SetComponentEnabledSettings : System.Collections.Generic.IList<Android.Content.PM.PackageManager.ComponentEnabledSetting> -> unit
override this.SetComponentEnabledSettings : System.Collections.Generic.IList<Android.Content.PM.PackageManager.ComponentEnabledSetting> -> unit

Parameters

settings
IList<PackageManager.ComponentEnabledSetting>

The list of component enabled settings to update. Note that an IllegalArgumentException is thrown if the duplicated component name is in the list or there's a conflict #DONT_KILL_APP flag between different components in the same package.

Attributes

Remarks

Set the enabled settings for package components such as activities, receivers, services and providers. This setting will override any enabled state which may have been set by the component in its manifest.

This api accepts a list of component changes, and applies them all atomically. The application can use this api if components have dependencies and need to be updated atomically.

The permission is not required if target components are running under the same uid with the caller.

Java documentation for android.content.pm.PackageManager.setComponentEnabledSettings(java.util.List<android.content.pm.PackageManager.ComponentEnabledSetting>).

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