共用方式為


DevicePolicyManager.SetAutoTimeZoneEnabled(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 zone on and off.

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

Parameters

admin
ComponentName

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

enabled
Boolean

Whether time zone 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 zone 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 zone. Instead, the network date and time zone will be used.

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