共用方式為


DevicePolicyManager.SetGlobalSetting(ComponentName, String, String) Method

Definition

This method is mostly deprecated.

[Android.Runtime.Register("setGlobalSetting", "(Landroid/content/ComponentName;Ljava/lang/String;Ljava/lang/String;)V", "GetSetGlobalSetting_Landroid_content_ComponentName_Ljava_lang_String_Ljava_lang_String_Handler")]
public virtual void SetGlobalSetting (Android.Content.ComponentName admin, string? setting, string? value);
[<Android.Runtime.Register("setGlobalSetting", "(Landroid/content/ComponentName;Ljava/lang/String;Ljava/lang/String;)V", "GetSetGlobalSetting_Landroid_content_ComponentName_Ljava_lang_String_Ljava_lang_String_Handler")>]
abstract member SetGlobalSetting : Android.Content.ComponentName * string * string -> unit
override this.SetGlobalSetting : Android.Content.ComponentName * string * string -> unit

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with.

setting
String

The name of the setting to update.

value
String

The value to update the setting to.

Attributes

Remarks

This method is mostly deprecated. Most of the settings that still have an effect have dedicated setter methods or user restrictions. See individual settings for details.

Called by device owner to update android.provider.Settings.Global settings. Validation that the value of the setting is in the correct form for the setting type should be performed by the caller.

The settings that can be updated with this method are: <ul> <li>android.provider.Settings.Global#ADB_ENABLED : use UserManager#DISALLOW_DEBUGGING_FEATURES instead to restrict users from enabling debugging features and this setting to turn adb on.</li> <li>android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED</li> <li>android.provider.Settings.Global#STAY_ON_WHILE_PLUGGED_IN This setting is only available from android.os.Build.VERSION_CODES#M onwards and can only be set if #setMaximumTimeToLock is not used to set a timeout.</li> <li>android.provider.Settings.Global#WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN</li> This setting is only available from android.os.Build.VERSION_CODES#M onwards.</li> </ul>

The following settings used to be supported, but can be controlled in other ways: <ul> <li>android.provider.Settings.Global#AUTO_TIME : Use #setAutoTimeEnabled and UserManager#DISALLOW_CONFIG_DATE_TIME instead.</li> <li>android.provider.Settings.Global#AUTO_TIME_ZONE : Use #setAutoTimeZoneEnabled and UserManager#DISALLOW_CONFIG_DATE_TIME instead.</li> <li>android.provider.Settings.Global#DATA_ROAMING : Use UserManager#DISALLOW_DATA_ROAMING instead.</li> </ul>

Changing the following settings has no effect as of android.os.Build.VERSION_CODES#M: <ul> <li>android.provider.Settings.Global#BLUETOOTH_ON. Use android.bluetooth.BluetoothAdapter#enable() and android.bluetooth.BluetoothAdapter#disable() instead.</li> <li>android.provider.Settings.Global#DEVELOPMENT_SETTINGS_ENABLED</li> <li>android.provider.Settings.Global#MODE_RINGER. Use android.media.AudioManager#setRingerMode(int) instead.</li> <li>android.provider.Settings.Global#NETWORK_PREFERENCE</li> <li>android.provider.Settings.Global#WIFI_ON. Use android.net.wifi.WifiManager#setWifiEnabled(boolean) instead.</li> <li>android.provider.Settings.Global#WIFI_SLEEP_POLICY. No longer has effect.</li> </ul>

Java documentation for android.app.admin.DevicePolicyManager.setGlobalSetting(android.content.ComponentName, java.lang.String, 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