语言

DevicePolicyManager.SetAutoTimeEnabled(ComponentName, Boolean) 方法

定义

由设备所有者、主要用户或组织拥有的托管配置文件的配置文件所有者的配置文件所有者调用,以打开和关闭自动时间。

[Android.Runtime.Register("setAutoTimeEnabled", "(Landroid/content/ComponentName;Z)V", "GetSetAutoTimeEnabled_Landroid_content_ComponentName_ZHandler", ApiSince=30)]
[Android.Runtime.RequiresPermission("android.permission.SET_TIME")]
public virtual void SetAutoTimeEnabled(Android.Content.ComponentName? admin, bool enabled);
[<Android.Runtime.Register("setAutoTimeEnabled", "(Landroid/content/ComponentName;Z)V", "GetSetAutoTimeEnabled_Landroid_content_ComponentName_ZHandler", ApiSince=30)>]
[<Android.Runtime.RequiresPermission("android.permission.SET_TIME")>]
abstract member SetAutoTimeEnabled : Android.Content.ComponentName * bool -> unit
override this.SetAutoTimeEnabled : Android.Content.ComponentName * bool -> unit

参数

admin
ComponentName

DeviceAdminReceiver此请求与此请求相关联。 如果调用方不是设备管理员,则为 Null。

enabled
Boolean

是否应从网络自动获取时间。

特性

注解

由设备所有者、主要用户或组织拥有的托管配置文件的配置文件所有者的配置文件所有者调用,以打开和关闭自动时间。

建议使用 UserManager#DISALLOW_CONFIG_DATE_TIME 呼叫者来防止用户更改此设置,这样用户将无法设置日期和时间区域。

Java文档android.app.admin.DevicePolicyManager.setAutoTimeEnabled(android.content.ComponentName, boolean)。

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于