DevicePolicyManager.SetApplicationRestrictions 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
为在调用用户中运行的给定目标应用程序设置应用程序限制。
[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><int
li>String
或<String[]
li>From android.os.Build.VERSION_CODES#M
或 Bundle
Bundle[]
</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 开放源代码项目创建和共享的工作进行的修改,并根据 Creative Commons 2.5 属性许可证中所述的术语使用。