DevicePolicyManager.SetPackagesSuspended Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Called by device or profile owners to suspend packages for this user.
[Android.Runtime.Register("setPackagesSuspended", "(Landroid/content/ComponentName;[Ljava/lang/String;Z)[Ljava/lang/String;", "GetSetPackagesSuspended_Landroid_content_ComponentName_arrayLjava_lang_String_ZHandler", ApiSince=24)]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_PACKAGE_STATE")]
public virtual string[] SetPackagesSuspended (Android.Content.ComponentName? admin, string[] packageNames, bool suspended);
[<Android.Runtime.Register("setPackagesSuspended", "(Landroid/content/ComponentName;[Ljava/lang/String;Z)[Ljava/lang/String;", "GetSetPackagesSuspended_Landroid_content_ComponentName_arrayLjava_lang_String_ZHandler", ApiSince=24)>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_PACKAGE_STATE")>]
abstract member SetPackagesSuspended : Android.Content.ComponentName * string[] * bool -> string[]
override this.SetPackagesSuspended : Android.Content.ComponentName * string[] * bool -> string[]
Parameters
- admin
- ComponentName
Which DeviceAdminReceiver
this request is associated with. Null if the
caller is not a device admin.
- packageNames
- String[]
The package names to suspend or unsuspend.
- suspended
- Boolean
If set to true
than the packages will be suspended, if set to
false
the packages will be unsuspended.
Returns
an array of package names for which the suspended status is not set as requested in this method.
- Attributes
Remarks
Called by device or profile owners to suspend packages for this user. This function can be called by a device owner, profile owner, or by a delegate given the #DELEGATION_PACKAGE_ACCESS
scope via #setDelegatedScopes
.
A suspended package will not be able to start activities. Its notifications will be hidden, it will not show up in recents, will not be able to show toasts or dialogs or ring the device.
The package must already be installed. If the package is uninstalled while suspended the package will no longer be suspended. The admin can block this by using #setUninstallBlocked
.
Some apps cannot be suspended, such as device admins, the active launcher, the required package installer, the required package uninstaller, the required package verifier, the default dialer, and the permission controller.
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.