Freigeben über


DevicePolicyManager.AddCrossProfileWidgetProvider Method

Definition

Called by the profile owner of a managed profile or a holder of the permission android.Manifest.permission#MANAGE_DEVICE_POLICY_PROFILE_INTERACTION to enable widget providers from a given package to be available in the parent profile.

[Android.Runtime.Register("addCrossProfileWidgetProvider", "(Landroid/content/ComponentName;Ljava/lang/String;)Z", "GetAddCrossProfileWidgetProvider_Landroid_content_ComponentName_Ljava_lang_String_Handler")]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_PROFILE_INTERACTION")]
public virtual bool AddCrossProfileWidgetProvider (Android.Content.ComponentName? admin, string? packageName);
[<Android.Runtime.Register("addCrossProfileWidgetProvider", "(Landroid/content/ComponentName;Ljava/lang/String;)Z", "GetAddCrossProfileWidgetProvider_Landroid_content_ComponentName_Ljava_lang_String_Handler")>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_PROFILE_INTERACTION")>]
abstract member AddCrossProfileWidgetProvider : Android.Content.ComponentName * string -> bool
override this.AddCrossProfileWidgetProvider : Android.Content.ComponentName * string -> bool

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with. Null if the caller is not a device admin.

packageName
String

The package from which widget providers are allowlisted.

Returns

Whether the package was added.

Attributes

Remarks

Called by the profile owner of a managed profile or a holder of the permission android.Manifest.permission#MANAGE_DEVICE_POLICY_PROFILE_INTERACTION to enable widget providers from a given package to be available in the parent profile. As a result the user will be able to add widgets from the allowlisted package running under the profile to a widget host which runs under the parent profile, for example the home screen. Note that a package may have zero or more provider components, where each component provides a different widget type.

<strong>Note:</strong> By default no widget provider package is allowlisted.

Java documentation for android.app.admin.DevicePolicyManager.addCrossProfileWidgetProvider(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

See also