DevicePolicyManager.SetApplicationRestrictions 方法

定义

为在调用用户中运行的给定目标应用程序设置应用程序限制。

[Android.Runtime.Register("setApplicationRestrictions", "(Landroid/content/ComponentName;Ljava/lang/String;Landroid/os/Bundle;)V", "GetSetApplicationRestrictions_Landroid_content_ComponentName_Ljava_lang_String_Landroid_os_Bundle_Handler")]
public virtual void SetApplicationRestrictions (Android.Content.ComponentName? admin, string? packageName, Android.OS.Bundle? settings);
[<Android.Runtime.Register("setApplicationRestrictions", "(Landroid/content/ComponentName;Ljava/lang/String;Landroid/os/Bundle;)V", "GetSetApplicationRestrictions_Landroid_content_ComponentName_Ljava_lang_String_Landroid_os_Bundle_Handler")>]
abstract member SetApplicationRestrictions : Android.Content.ComponentName * string * Android.OS.Bundle -> unit
override this.SetApplicationRestrictions : Android.Content.ComponentName * string * Android.OS.Bundle -> unit

参数

admin
ComponentName

DeviceAdminReceiver此请求与哪个请求相关联,或者null应用程序限制管理包是否调用。

packageName
String

要更新其受限设置的包的名称。

settings
Bundle

要由接收应用程序分析的 A Bundle ,传达一组新的活动限制。

属性

注解

为在调用用户中运行的给定目标应用程序设置应用程序限制。

调用方必须是该用户的配置文件或设备所有者,或者允许通过 #setDelegatedScopes 范围管理应用程序限制的 #DELEGATION_APP_RESTRICTIONS 包;否则将引发安全异常。

提供的Bundle键值对包括键值对,其中值类型可以是:<ul<>li<boolean>li><intli>String 或<String[] li>From android.os.Build.VERSION_CODES#MBundleBundle[]</ul>

如果限制尚不可用,但可能在不久的将来应用,调用方可以通过添加到 UserManager#KEY_RESTRICTIONS_PENDING 设置参数来通知目标应用程序。

除了配置文件或设备所有者之外,应用程序限制仅对 UserManager#getApplicationRestrictions(String)目标应用程序可见,以及通过 #getApplicationRestrictions管理包的应用程序限制。

从 Android 版本 android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE开始,多个管理员可以为同一应用程序设置应用限制,目标应用程序可以通过每个管理员 android.content.RestrictionsManager#getApplicationRestrictionsPerAdmin获取设置的应用限制列表。

注意:此方法执行磁盘 I/O,不应在主线程上调用

适用于 . 的 android.app.admin.DevicePolicyManager.setApplicationRestrictions(android.content.ComponentName, java.lang.String, android.os.Bundle)Java 文档

本页的某些部分是根据 Android 开放源代码项目创建和共享的工作进行的修改,并根据 Creative Commons 2.5 属性许可证中所述的术语使用。

适用于

另请参阅