Added in API level 17

Global


class Global : Settings.NameValueTable
kotlin.Any
   ↳ android.provider.Settings.NameValueTable
   ↳ android.provider.Settings.Global

Global system settings, containing preferences that always apply identically to all defined users. Applications can read these but are not allowed to write; like the "Secure" settings, these are for preferences that the user must explicitly modify through the system UI or specialized APIs for those values.

Summary

Constants
static String

Whether ADB over USB is enabled.

static String

Whether Airplane Mode is on.

static String

A comma separated list of radios that need to be disabled when airplane mode is on.

static String

If not 0, the activity manager will aggressively finish activities and processes as soon as they are no longer needed.

static String

Scaling factor for Animator-based animations.

static String

Whether applying ramping ringer on incoming phone call ringtone.

static String

Value to specify if the device's UTC system clock should be set automatically, e.

static String

Value to specify if the device's time zone system property should be set automatically, e.

static String

Whether bluetooth is enabled/disabled 0=disabled.

static String

Boot count since the device starts running API level 24.

static String

Whether to enable contacts metadata syncing or not The value 1 - enable, 0 - disable

static String

Whether or not data roaming is enabled.

static String

Name of an application package to be debugged.

static String

Whether user has enabled development settings.

static String

The name of the device

static String

Whether the device has been provisioned (0 = false, 1 = true).

static String

Host name and port for global http proxy.

static String

static String

Ringer mode.

static String

User preference for which network(s) should be used.

static String

Constant for use in AIRPLANE_MODE_RADIOS or SATELLITE_MODE_RADIOS to specify Bluetooth radio.

static String

Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.

static String

Constant for use in AIRPLANE_MODE_RADIOS or SATELLITE_MODE_RADIOS to specify NFC radio.

static String

Constant for use in AIRPLANE_MODE_RADIOS or SATELLITE_MODE_RADIOS to specify Wi-Fi radio.

static String

Indicates whether the device is under restricted secure FRP mode.

static String

Control whether the process CPU usage meter should be shown.

static String

Whether we keep the device on while the device is plugged in.

static String

Scaling factor for activity transition animations.

static String

USB Mass Storage Enabled

static String

If this setting is set (to anything), then all references to Gmail on the device must change to Google Mail.

static String

If 1, when launching DEBUG_APP it will wait for the debugger before starting user code.

static String

This setting controls whether WiFi configurations created by a Device Owner app should be locked down (that is, be editable or removable only by the Device Owner App, not even by Settings app).

static String

The maximum number of times we will retry a connection to an access point for which we have failed in acquiring an IP address from DHCP.

static String

Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile data connectivity to be established after a disconnect from Wi-Fi.

static String

Whether to notify the user of open networks.

static String

Delay (in seconds) before repeating the Wi-Fi networks available notification.

static String

When the number of open networks exceeds this number, the least-recently-used excess networks will be removed.

static String

Whether the Wi-Fi should be on.

static String

The policy for deciding when Wi-Fi should go to sleep (which will in turn switch to using the mobile data as an Internet connection).

static Int

Value for WIFI_SLEEP_POLICY to use the default Wi-Fi sleep policy, which is to sleep shortly after the turning off according to the STAY_ON_WHILE_PLUGGED_IN setting.

static Int

Value for WIFI_SLEEP_POLICY to never go to sleep.

static Int

Value for WIFI_SLEEP_POLICY to use the default policy when the device is on battery, and never go to sleep when the device is plugged in.

static String

Whether the Wi-Fi watchdog is enabled.

static String

Scaling factor for normal window animations.

Inherited constants
Public constructors

Public methods
static Float

Convenience function for retrieving a single secure settings value as a float.

static Float
getFloat(cr: ContentResolver!, name: String!, def: Float)

Convenience function for retrieving a single secure settings value as a floating point number.

static Int
getInt(cr: ContentResolver!, name: String!)

Convenience function for retrieving a single secure settings value as an integer.

static Int
getInt(cr: ContentResolver!, name: String!, def: Int)

Convenience function for retrieving a single secure settings value as an integer.

static Long

Convenience function for retrieving a single secure settings value as a long.

static Long
getLong(cr: ContentResolver!, name: String!, def: Long)

Convenience function for retrieving a single secure settings value as a long.

static String!
getString(resolver: ContentResolver!, name: String!)

Look up a name in the database.

static Uri!
getUriFor(name: String!)

Construct the content URI for a particular name/value pair, useful for monitoring changes with a ContentObserver.

static Boolean
putFloat(cr: ContentResolver!, name: String!, value: Float)

Convenience function for updating a single settings value as a floating point number.

static Boolean
putInt(cr: ContentResolver!, name: String!, value: Int)

Convenience function for updating a single settings value as an integer.

static Boolean
putLong(cr: ContentResolver!, name: String!, value: Long)

Convenience function for updating a secure settings value as a long integer.

static Boolean
putString(resolver: ContentResolver!, name: String!, value: String!)

Store a name/value pair into the database.

Inherited functions
Properties
static Uri!

The content:// style URL for global secure settings items.

Constants

ADB_ENABLED

Added in API level 17
static val ADB_ENABLED: String

Whether ADB over USB is enabled.

Value: "adb_enabled"

AIRPLANE_MODE_ON

Added in API level 17
static val AIRPLANE_MODE_ON: String

Whether Airplane Mode is on.

Value: "airplane_mode_on"

AIRPLANE_MODE_RADIOS

Added in API level 17
static val AIRPLANE_MODE_RADIOS: String

A comma separated list of radios that need to be disabled when airplane mode is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are included in the comma separated list.

Value: "airplane_mode_radios"

ALWAYS_FINISH_ACTIVITIES

Added in API level 17
static val ALWAYS_FINISH_ACTIVITIES: String

If not 0, the activity manager will aggressively finish activities and processes as soon as they are no longer needed. If 0, the normal extended lifetime is used.

Value: "always_finish_activities"

ANIMATOR_DURATION_SCALE

Added in API level 17
static val ANIMATOR_DURATION_SCALE: String

Scaling factor for Animator-based animations. This affects both the start delay and duration of all such animations. The value is a float. Setting to 0.0f will cause animations to end immediately. The default value is 1.0f.

Value: "animator_duration_scale"

APPLY_RAMPING_RINGER

Added in API level 29
Deprecated in API level 33
static val APPLY_RAMPING_RINGER: String

Deprecated: Use AudioManager.isRampingRingerEnabled() instead

Whether applying ramping ringer on incoming phone call ringtone.

1 = apply ramping ringer

0 = do not apply ramping ringer

Value: "apply_ramping_ringer"

AUTO_TIME

Added in API level 17
static val AUTO_TIME: String

Value to specify if the device's UTC system clock should be set automatically, e.g. using telephony signals like NITZ, or other sources like GNSS or NTP.

Prefer android.app.time.TimeManager API calls to determine the state of automatic time detection instead of directly observing this setting as it may be ignored by the time_detector service under various conditions.

1=yes, 0=no (manual)

Value: "auto_time"

AUTO_TIME_ZONE

Added in API level 17
static val AUTO_TIME_ZONE: String

Value to specify if the device's time zone system property should be set automatically, e.g. using telephony signals like MCC and NITZ, or other mechanisms like the location.

Prefer android.app.time.TimeManager API calls to determine the state of automatic time zone detection instead of directly observing this setting as it may be ignored by the time_zone_detector service under various conditions.

1=yes, 0=no (manual).

Value: "auto_time_zone"

BLUETOOTH_ON

Added in API level 17
static val BLUETOOTH_ON: String

Whether bluetooth is enabled/disabled 0=disabled. 1=enabled.

Value: "bluetooth_on"

BOOT_COUNT

Added in API level 24
static val BOOT_COUNT: String

Boot count since the device starts running API level 24.

Type: int

Value: "boot_count"

CONTACT_METADATA_SYNC_ENABLED

Added in API level 24
static val CONTACT_METADATA_SYNC_ENABLED: String

Whether to enable contacts metadata syncing or not The value 1 - enable, 0 - disable

Value: "contact_metadata_sync_enabled"

DATA_ROAMING

Added in API level 17
static val DATA_ROAMING: String

Whether or not data roaming is enabled. (0 = false, 1 = true) Use TelephonyManager.isDataRoamingEnabled instead of calling via settings.

Value: "data_roaming"

DEBUG_APP

Added in API level 17
static val DEBUG_APP: String

Name of an application package to be debugged.

Value: "debug_app"

DEVELOPMENT_SETTINGS_ENABLED

Added in API level 17
static val DEVELOPMENT_SETTINGS_ENABLED: String

Whether user has enabled development settings.

Value: "development_settings_enabled"

DEVICE_NAME

Added in API level 25
static val DEVICE_NAME: String

The name of the device

Value: "device_name"

DEVICE_PROVISIONED

Added in API level 17
static val DEVICE_PROVISIONED: String

Whether the device has been provisioned (0 = false, 1 = true).

On a multiuser device with a separate system user, the screen may be locked as soon as this is set to true and further activities cannot be launched on the system user unless they are marked to show over keyguard.

Value: "device_provisioned"

HTTP_PROXY

Added in API level 17
static val HTTP_PROXY: String

Host name and port for global http proxy. Uses ':' seperator for between host and port.

Value: "http_proxy"

INSTALL_NON_MARKET_APPS

Added in API level 17
Deprecated in API level 21
static val INSTALL_NON_MARKET_APPS: String

Deprecated: Use android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS instead

Value: "install_non_market_apps"

MODE_RINGER

Added in API level 17
static val MODE_RINGER: String

Ringer mode. This is used internally, changing this value will not change the ringer mode. See AudioManager.

Value: "mode_ringer"

NETWORK_PREFERENCE

Added in API level 17
static val NETWORK_PREFERENCE: String

User preference for which network(s) should be used. Only the connectivity service should touch this.

Value: "network_preference"

RADIO_BLUETOOTH

Added in API level 17
static val RADIO_BLUETOOTH: String

Constant for use in AIRPLANE_MODE_RADIOS or SATELLITE_MODE_RADIOS to specify Bluetooth radio.

Value: "bluetooth"

RADIO_CELL

Added in API level 17
static val RADIO_CELL: String

Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.

Value: "cell"

RADIO_NFC

Added in API level 17
static val RADIO_NFC: String

Constant for use in AIRPLANE_MODE_RADIOS or SATELLITE_MODE_RADIOS to specify NFC radio.

Value: "nfc"

RADIO_WIFI

Added in API level 17
static val RADIO_WIFI: String

Constant for use in AIRPLANE_MODE_RADIOS or SATELLITE_MODE_RADIOS to specify Wi-Fi radio.

Value: "wifi"

SECURE_FRP_MODE

Added in API level 34
static val SECURE_FRP_MODE: String

Indicates whether the device is under restricted secure FRP mode. Secure FRP mode is enabled when the device is under FRP. On solving of FRP challenge, device is removed from this mode.

Type: int (0 for false, 1 for true)

Value: "secure_frp_mode"

SHOW_PROCESSES

Added in API level 17
Deprecated in API level 25
static val SHOW_PROCESSES: String

Deprecated: This functionality is no longer available as of android.os.Build.VERSION_CODES#N_MR1.

Control whether the process CPU usage meter should be shown.

Value: "show_processes"

STAY_ON_WHILE_PLUGGED_IN

Added in API level 17
static val STAY_ON_WHILE_PLUGGED_IN: String

Whether we keep the device on while the device is plugged in. Supported values are:

These values can be OR-ed together.

Value: "stay_on_while_plugged_in"

TRANSITION_ANIMATION_SCALE

Added in API level 17
static val TRANSITION_ANIMATION_SCALE: String

Scaling factor for activity transition animations. The value is a float. Setting to 0.0f will disable window animations.

Value: "transition_animation_scale"

USB_MASS_STORAGE_ENABLED

Added in API level 17
static val USB_MASS_STORAGE_ENABLED: String

USB Mass Storage Enabled

Value: "usb_mass_storage_enabled"

USE_GOOGLE_MAIL

Added in API level 17
static val USE_GOOGLE_MAIL: String

If this setting is set (to anything), then all references to Gmail on the device must change to Google Mail.

Value: "use_google_mail"

WAIT_FOR_DEBUGGER

Added in API level 17
static val WAIT_FOR_DEBUGGER: String

If 1, when launching DEBUG_APP it will wait for the debugger before starting user code. If 0, it will run normally.

Value: "wait_for_debugger"

WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN

Added in API level 23
static val WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN: String

This setting controls whether WiFi configurations created by a Device Owner app should be locked down (that is, be editable or removable only by the Device Owner App, not even by Settings app). This setting takes integer values. Non-zero values mean DO created configurations are locked down. Value of zero means they are not. Default value in the absence of actual value to this setting is 0.

Value: "wifi_device_owner_configs_lockdown"

WIFI_MAX_DHCP_RETRY_COUNT

Added in API level 17
static val WIFI_MAX_DHCP_RETRY_COUNT: String

The maximum number of times we will retry a connection to an access point for which we have failed in acquiring an IP address from DHCP. A value of N means that we will make N+1 connection attempts in all.

Value: "wifi_max_dhcp_retry_count"

WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS

Added in API level 17
static val WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS: String

Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile data connectivity to be established after a disconnect from Wi-Fi.

Value: "wifi_mobile_data_transition_wakelock_timeout_ms"

WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON

Added in API level 17
Deprecated in API level 26
static val WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON: String

Deprecated: This feature is no longer controlled by this setting in android.os.Build.VERSION_CODES#O.

Whether to notify the user of open networks.

If not connected and the scan results have an open network, we will put this notification up. If we attempt to connect to a network or the open network(s) disappear, we remove the notification. When we show the notification, we will not show it again for android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY time.

Value: "wifi_networks_available_notification_on"

WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY

Added in API level 17
Deprecated in API level 30
static val WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY: String

Deprecated: This is no longer used or set by the platform.

Delay (in seconds) before repeating the Wi-Fi networks available notification. Connecting to a network will reset the timer.

Value: "wifi_networks_available_repeat_delay"

WIFI_NUM_OPEN_NETWORKS_KEPT

Added in API level 17
Deprecated in API level 30
static val WIFI_NUM_OPEN_NETWORKS_KEPT: String

Deprecated: This is no longer used or set by the platform.

When the number of open networks exceeds this number, the least-recently-used excess networks will be removed.

Value: "wifi_num_open_networks_kept"

WIFI_ON

Added in API level 17
static val WIFI_ON: String

Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this.

Value: "wifi_on"

WIFI_SLEEP_POLICY

Added in API level 17
Deprecated in API level 30
static val WIFI_SLEEP_POLICY: String

Deprecated: This is no longer used or set by the platform.

The policy for deciding when Wi-Fi should go to sleep (which will in turn switch to using the mobile data as an Internet connection).

Set to one of WIFI_SLEEP_POLICY_DEFAULT, WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED, or WIFI_SLEEP_POLICY_NEVER.

Value: "wifi_sleep_policy"

WIFI_SLEEP_POLICY_DEFAULT

Added in API level 17
Deprecated in API level 30
static val WIFI_SLEEP_POLICY_DEFAULT: Int

Deprecated: This is no longer used by the platform.

Value for WIFI_SLEEP_POLICY to use the default Wi-Fi sleep policy, which is to sleep shortly after the turning off according to the STAY_ON_WHILE_PLUGGED_IN setting.

Value: 0

WIFI_SLEEP_POLICY_NEVER

Added in API level 17
Deprecated in API level 30
static val WIFI_SLEEP_POLICY_NEVER: Int

Deprecated: This is no longer used by the platform.

Value for WIFI_SLEEP_POLICY to never go to sleep.

Value: 2

WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED

Added in API level 17
Deprecated in API level 30
static val WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED: Int

Deprecated: This is no longer used by the platform.

Value for WIFI_SLEEP_POLICY to use the default policy when the device is on battery, and never go to sleep when the device is plugged in.

Value: 1

WIFI_WATCHDOG_ON

Added in API level 17
static val WIFI_WATCHDOG_ON: String

Whether the Wi-Fi watchdog is enabled.

Value: "wifi_watchdog_on"

WINDOW_ANIMATION_SCALE

Added in API level 17
static val WINDOW_ANIMATION_SCALE: String

Scaling factor for normal window animations. The value is a float. Setting to 0.0f will disable window animations.

Value: "window_animation_scale"

Public constructors

Global

Global()

Public methods

getFloat

Added in API level 17
static fun getFloat(
    cr: ContentResolver!,
    name: String!
): Float

Convenience function for retrieving a single secure settings value as a float. Note that internally setting values are always stored as strings; this function converts the string to a float for you.

This version does not take a default value. If the setting has not been set, or the string value is not a number, it throws SettingNotFoundException.

Parameters
cr ContentResolver!: The ContentResolver to access.
name String!: The name of the setting to retrieve.
Return
Float The setting's current value.
Exceptions
android.provider.Settings.SettingNotFoundException Thrown if a setting by the given name can't be found or the setting value is not a float.

getFloat

Added in API level 17
static fun getFloat(
    cr: ContentResolver!,
    name: String!,
    def: Float
): Float

Convenience function for retrieving a single secure settings value as a floating point number. Note that internally setting values are always stored as strings; this function converts the string to an float for you. The default value will be returned if the setting is not defined or not a valid float.

Parameters
cr ContentResolver!: The ContentResolver to access.
name String!: The name of the setting to retrieve.
def Float: Value to return if the setting is not defined.
Return
Float The setting's current value, or 'def' if it is not defined or not a valid float.

getInt

Added in API level 17
static fun getInt(
    cr: ContentResolver!,
    name: String!
): Int

Convenience function for retrieving a single secure settings value as an integer. Note that internally setting values are always stored as strings; this function converts the string to an integer for you.

This version does not take a default value. If the setting has not been set, or the string value is not a number, it throws SettingNotFoundException.

Parameters
cr ContentResolver!: The ContentResolver to access.
name String!: The name of the setting to retrieve.
Return
Int The setting's current value.
Exceptions
android.provider.Settings.SettingNotFoundException Thrown if a setting by the given name can't be found or the setting value is not an integer.

getInt

Added in API level 17
static fun getInt(
    cr: ContentResolver!,
    name: String!,
    def: Int
): Int

Convenience function for retrieving a single secure settings value as an integer. Note that internally setting values are always stored as strings; this function converts the string to an integer for you. The default value will be returned if the setting is not defined or not an integer.

Parameters
cr ContentResolver!: The ContentResolver to access.
name String!: The name of the setting to retrieve.
def Int: Value to return if the setting is not defined.
Return
Int The setting's current value, or 'def' if it is not defined or not a valid integer.

getLong

Added in API level 17
static fun getLong(
    cr: ContentResolver!,
    name: String!
): Long

Convenience function for retrieving a single secure settings value as a long. Note that internally setting values are always stored as strings; this function converts the string to a long for you.

This version does not take a default value. If the setting has not been set, or the string value is not a number, it throws SettingNotFoundException.

Parameters
cr ContentResolver!: The ContentResolver to access.
name String!: The name of the setting to retrieve.
Return
Long The setting's current value.
Exceptions
android.provider.Settings.SettingNotFoundException Thrown if a setting by the given name can't be found or the setting value is not an integer.

getLong

Added in API level 17
static fun getLong(
    cr: ContentResolver!,
    name: String!,
    def: Long
): Long

Convenience function for retrieving a single secure settings value as a long. Note that internally setting values are always stored as strings; this function converts the string to a long for you. The default value will be returned if the setting is not defined or not a long.

Parameters
cr ContentResolver!: The ContentResolver to access.
name String!: The name of the setting to retrieve.
def Long: Value to return if the setting is not defined.
Return
Long The setting's current value, or 'def' if it is not defined or not a valid long.

getString

Added in API level 17
static fun getString(
    resolver: ContentResolver!,
    name: String!
): String!

Look up a name in the database.

Parameters
resolver ContentResolver!: to access the database with
name String!: to look up in the table
Return
String! the corresponding value, or null if not present

getUriFor

Added in API level 17
static fun getUriFor(name: String!): Uri!

Construct the content URI for a particular name/value pair, useful for monitoring changes with a ContentObserver.

Parameters
name String!: to look up in the table
Return
Uri! the corresponding content URI, or null if not present

putFloat

Added in API level 17
static fun putFloat(
    cr: ContentResolver!,
    name: String!,
    value: Float
): Boolean

Convenience function for updating a single settings value as a floating point number. This will either create a new entry in the table if the given name does not exist, or modify the value of the existing row with that name. Note that internally setting values are always stored as strings, so this function converts the given value to a string before storing it.

Parameters
cr ContentResolver!: The ContentResolver to access.
name String!: The name of the setting to modify.
value Float: The new value for the setting.
Return
Boolean true if the value was set, false on database errors

putInt

Added in API level 17
static fun putInt(
    cr: ContentResolver!,
    name: String!,
    value: Int
): Boolean

Convenience function for updating a single settings value as an integer. This will either create a new entry in the table if the given name does not exist, or modify the value of the existing row with that name. Note that internally setting values are always stored as strings, so this function converts the given value to a string before storing it.

Parameters
cr ContentResolver!: The ContentResolver to access.
name String!: The name of the setting to modify.
value Int: The new value for the setting.
Return
Boolean true if the value was set, false on database errors

putLong

Added in API level 17
static fun putLong(
    cr: ContentResolver!,
    name: String!,
    value: Long
): Boolean

Convenience function for updating a secure settings value as a long integer. This will either create a new entry in the table if the given name does not exist, or modify the value of the existing row with that name. Note that internally setting values are always stored as strings, so this function converts the given value to a string before storing it.

Parameters
cr ContentResolver!: The ContentResolver to access.
name String!: The name of the setting to modify.
value Long: The new value for the setting.
Return
Boolean true if the value was set, false on database errors

putString

Added in API level 17
static fun putString(
    resolver: ContentResolver!,
    name: String!,
    value: String!
): Boolean

Store a name/value pair into the database.

Parameters
resolver ContentResolver!: to access the database with
name String!: to store
value String!: to associate with the name
Return
Boolean true if the value was set, false on database errors

Properties

CONTENT_URI

Added in API level 17
static val CONTENT_URI: Uri!

The content:// style URL for global secure settings items. Not public.