DevicePolicyManager.SetAutoTimeEnabled(ComponentName, Boolean) Method

Definition

Called by a device owner, a profile owner for the primary user or a profile owner of an organization-owned managed profile to turn auto time on and off.

[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

Parameters

admin
ComponentName

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

enabled
Boolean

Whether time should be obtained automatically from the network or not.

Attributes

Remarks

Called by a device owner, a profile owner for the primary user or a profile owner of an organization-owned managed profile to turn auto time on and off. Callers are recommended to use UserManager#DISALLOW_CONFIG_DATE_TIME to prevent the user from changing this setting.

If user restriction UserManager#DISALLOW_CONFIG_DATE_TIME is used, no user will be able set the date and time. Instead, the network date and time will be used.

Java documentation for android.app.admin.DevicePolicyManager.setAutoTimeEnabled(android.content.ComponentName, boolean).

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