Share via


DevicePolicyManager.SetTimeZone(ComponentName, String) Method

Definition

Called by a device owner or a profile owner of an organization-owned managed profile to set the system's persistent default time zone.

[Android.Runtime.Register("setTimeZone", "(Landroid/content/ComponentName;Ljava/lang/String;)Z", "GetSetTimeZone_Landroid_content_ComponentName_Ljava_lang_String_Handler", ApiSince=28)]
[Android.Runtime.RequiresPermission("android.permission.SET_TIME_ZONE")]
public virtual bool SetTimeZone (Android.Content.ComponentName? admin, string? timeZone);
[<Android.Runtime.Register("setTimeZone", "(Landroid/content/ComponentName;Ljava/lang/String;)Z", "GetSetTimeZone_Landroid_content_ComponentName_Ljava_lang_String_Handler", ApiSince=28)>]
[<Android.Runtime.RequiresPermission("android.permission.SET_TIME_ZONE")>]
abstract member SetTimeZone : Android.Content.ComponentName * string -> bool
override this.SetTimeZone : Android.Content.ComponentName * string -> bool

Parameters

admin
ComponentName

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

timeZone
String

one of the Olson ids from the list returned by java.util.TimeZone#getAvailableIDs

Returns

true if set timezone succeeded, false otherwise.

Attributes

Remarks

Called by a device owner or a profile owner of an organization-owned managed profile to set the system's persistent default time zone. This only takes effect if called when android.provider.Settings.Global#AUTO_TIME_ZONE is 0, otherwise false will be returned.

Java documentation for android.app.admin.DevicePolicyManager.setTimeZone(android.content.ComponentName, java.lang.String).

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