Compartilhar via


DevicePolicyManager.GetApplicationRestrictions(ComponentName, String) Method

Definition

Retrieves the application restrictions for a given target application running in the calling user.

[Android.Runtime.Register("getApplicationRestrictions", "(Landroid/content/ComponentName;Ljava/lang/String;)Landroid/os/Bundle;", "GetGetApplicationRestrictions_Landroid_content_ComponentName_Ljava_lang_String_Handler")]
public virtual Android.OS.Bundle GetApplicationRestrictions (Android.Content.ComponentName? admin, string? packageName);
[<Android.Runtime.Register("getApplicationRestrictions", "(Landroid/content/ComponentName;Ljava/lang/String;)Landroid/os/Bundle;", "GetGetApplicationRestrictions_Landroid_content_ComponentName_Ljava_lang_String_Handler")>]
abstract member GetApplicationRestrictions : Android.Content.ComponentName * string -> Android.OS.Bundle
override this.GetApplicationRestrictions : Android.Content.ComponentName * string -> Android.OS.Bundle

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with, or null if called by the application restrictions managing package.

packageName
String

The name of the package to fetch restricted settings of.

Returns

Bundle of settings corresponding to what was set last time DevicePolicyManager#setApplicationRestrictions was called, or an empty Bundle if no restrictions have been set.

Attributes

Remarks

Retrieves the application restrictions for a given target application running in the calling user.

The caller must be a profile or device owner on that user, or the package allowed to manage application restrictions via #setDelegatedScopes with the #DELEGATION_APP_RESTRICTIONS scope; otherwise a security exception will be thrown.

NOTE: The method performs disk I/O and shouldn't be called on the main thread

Java documentation for android.app.admin.DevicePolicyManager.getApplicationRestrictions(android.content.ComponentName, java.lang.String).

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