to top
Android APIs
public static final class

Settings.Secure

extends Settings.NameValueTable
java.lang.Object
   ↳ android.provider.Settings.NameValueTable
     ↳ android.provider.Settings.Secure

Class Overview

Secure system settings, containing system preferences that applications can read but are not allowed to write. These are for preferences that the user must explicitly modify through the system UI or specialized APIs for those values, not modified directly by applications.

Summary

Constants
String ACCESSIBILITY_ENABLED If accessibility is enabled.
String ACCESSIBILITY_SPEAK_PASSWORD Whether to speak passwords while in accessibility mode.
String ADB_ENABLED Whether ADB is enabled.
String ALLOWED_GEOLOCATION_ORIGINS Origins for which browsers should allow geolocation by default.
String ALLOW_MOCK_LOCATION Setting to allow mock locations and location provider status to be injected into the LocationManager service for testing purposes during application development.
String ANDROID_ID A 64-bit number (as a hex string) that is randomly generated on the device's first boot and should remain constant for the lifetime of the device.
String BACKGROUND_DATA Whether background data usage is allowed by the user.
String BLUETOOTH_ON Whether bluetooth is enabled/disabled 0=disabled.
String DATA_ROAMING Whether or not data roaming is enabled.
String DEFAULT_INPUT_METHOD Setting to record the input method used by default, holding the ID of the desired method.
String DEVELOPMENT_SETTINGS_ENABLED Whether user has enabled development settings.
String DEVICE_PROVISIONED Whether the device has been provisioned (0 = false, 1 = true)
String ENABLED_ACCESSIBILITY_SERVICES List of the enabled accessibility providers.
String ENABLED_INPUT_METHODS List of input methods that are currently enabled.
String HTTP_PROXY Host name and port for global http proxy.
String INPUT_METHOD_SELECTOR_VISIBILITY Setting to record the visibility of input method selector
String INSTALL_NON_MARKET_APPS Whether the package installer should allow installation of apps downloaded from sources other than Google Play.
String LOCATION_PROVIDERS_ALLOWED Comma-separated list of location providers that activities may access.
String LOCK_PATTERN_ENABLED Whether autolock is enabled (0 = false, 1 = true)
String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED Whether lock pattern will vibrate as user enters (0 = false, 1 = true)
String LOCK_PATTERN_VISIBLE Whether lock pattern is visible as user enters (0 = false, 1 = true)
String LOGGING_ID This constant is deprecated. This identifier is poorly initialized and has many collisions. It should not be used.
String NETWORK_PREFERENCE User preference for which network(s) should be used.
String PARENTAL_CONTROL_ENABLED No longer supported.
String PARENTAL_CONTROL_LAST_UPDATE No longer supported.
String PARENTAL_CONTROL_REDIRECT_URL No longer supported.
String SELECTED_INPUT_METHOD_SUBTYPE Setting to record the input method subtype used by default, holding the ID of the desired method.
String SETTINGS_CLASSNAME Settings classname to launch when Settings is clicked from All Applications.
String SYS_PROP_SETTING_VERSION
String TOUCH_EXPLORATION_ENABLED If touch exploration is enabled.
String TTS_DEFAULT_COUNTRY This constant is deprecated. this setting is no longer in use, as of the Ice Cream Sandwich release. Apps should never need to read this setting directly, instead can query the TextToSpeech framework classes for the default locale. getLanguage().
String TTS_DEFAULT_LANG This constant is deprecated. this setting is no longer in use, as of the Ice Cream Sandwich release. Apps should never need to read this setting directly, instead can query the TextToSpeech framework classes for the default locale. getLanguage().
String TTS_DEFAULT_PITCH Default text-to-speech engine pitch.
String TTS_DEFAULT_RATE Default text-to-speech engine speech rate.
String TTS_DEFAULT_SYNTH Default text-to-speech engine.
String TTS_DEFAULT_VARIANT This constant is deprecated. this setting is no longer in use, as of the Ice Cream Sandwich release. Apps should never need to read this setting directly, instead can query the TextToSpeech framework classes for the locale that is in use getLanguage().
String TTS_ENABLED_PLUGINS Space delimited list of plugin packages that are enabled.
String TTS_USE_DEFAULTS This constant is deprecated. The value of this setting is no longer respected by the framework text to speech APIs as of the Ice Cream Sandwich release.
String USB_MASS_STORAGE_ENABLED USB Mass Storage Enabled
String USE_GOOGLE_MAIL If this setting is set (to anything), then all references to Gmail on the device must change to Google Mail.
String WIFI_MAX_DHCP_RETRY_COUNT 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.
String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS 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.
String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON Whether to notify the user of open networks.
String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY Delay (in seconds) before repeating the Wi-Fi networks available notification.
String WIFI_NUM_OPEN_NETWORKS_KEPT When the number of open networks exceeds this number, the least-recently-used excess networks will be removed.
String WIFI_ON Whether the Wi-Fi should be on.
String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE The acceptable packet loss percentage (range 0 - 100) before trying another AP on the same network.
String WIFI_WATCHDOG_AP_COUNT The number of access points required for a network in order for the watchdog to monitor it.
String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS The delay between background checks.
String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED Whether the Wi-Fi watchdog is enabled for background checking even after it thinks the user has connected to a good access point.
String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS The timeout for a background ping
String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT The number of initial pings to perform that *may* be ignored if they fail.
String WIFI_WATCHDOG_MAX_AP_CHECKS The maximum number of access points (per network) to attempt to test.
String WIFI_WATCHDOG_ON Whether the Wi-Fi watchdog is enabled.
String WIFI_WATCHDOG_PING_COUNT The number of pings to test if an access point is a good connection.
String WIFI_WATCHDOG_PING_DELAY_MS The delay between pings.
String WIFI_WATCHDOG_PING_TIMEOUT_MS The timeout per ping.
String WIFI_WATCHDOG_WATCH_LIST A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled.
[Expand]
Inherited Constants
From class android.provider.Settings.NameValueTable
From interface android.provider.BaseColumns
Fields
public static final Uri CONTENT_URI The content:// style URL for this table
Public Constructors
Settings.Secure()
Public Methods
static float getFloat(ContentResolver cr, String name, float def)
Convenience function for retrieving a single secure settings value as a floating point number.
static float getFloat(ContentResolver cr, String name)
Convenience function for retrieving a single secure settings value as a float.
static int getInt(ContentResolver cr, String name)
Convenience function for retrieving a single secure settings value as an integer.
static int getInt(ContentResolver cr, String name, int def)
Convenience function for retrieving a single secure settings value as an integer.
static long getLong(ContentResolver cr, String name, long def)
Convenience function for retrieving a single secure settings value as a long.
static long getLong(ContentResolver cr, String name)
Convenience function for retrieving a single secure settings value as a long.
synchronized static String getString(ContentResolver resolver, String name)
Look up a name in the database.
static Uri getUriFor(String name)
Construct the content URI for a particular name/value pair, useful for monitoring changes with a ContentObserver.
final static boolean isLocationProviderEnabled(ContentResolver cr, String provider)
Helper method for determining if a location provider is enabled.
static boolean putFloat(ContentResolver cr, String name, float value)
Convenience function for updating a single settings value as a floating point number.
static boolean putInt(ContentResolver cr, String name, int value)
Convenience function for updating a single settings value as an integer.
static boolean putLong(ContentResolver cr, String name, long value)
Convenience function for updating a secure settings value as a long integer.
static boolean putString(ContentResolver resolver, String name, String value)
Store a name/value pair into the database.
final static void setLocationProviderEnabled(ContentResolver cr, String provider, boolean enabled)
Thread-safe method for enabling or disabling a single location provider.
[Expand]
Inherited Methods
From class android.provider.Settings.NameValueTable
From class java.lang.Object

Constants

public static final String ACCESSIBILITY_ENABLED

Since: API Level 4

If accessibility is enabled.

Constant Value: "accessibility_enabled"

public static final String ACCESSIBILITY_SPEAK_PASSWORD

Since: API Level 15

Whether to speak passwords while in accessibility mode.

Constant Value: "speak_password"

public static final String ADB_ENABLED

Since: API Level 3

Whether ADB is enabled.

Constant Value: "adb_enabled"

public static final String ALLOWED_GEOLOCATION_ORIGINS

Since: API Level 8

Origins for which browsers should allow geolocation by default. The value is a space-separated list of origins.

Constant Value: "allowed_geolocation_origins"

public static final String ALLOW_MOCK_LOCATION

Since: API Level 3

Setting to allow mock locations and location provider status to be injected into the LocationManager service for testing purposes during application development. These locations and status values override actual location and status information generated by network, gps, or other location providers.

Constant Value: "mock_location"

public static final String ANDROID_ID

Since: API Level 3

A 64-bit number (as a hex string) that is randomly generated on the device's first boot and should remain constant for the lifetime of the device. (The value may change if a factory reset is performed on the device.)

Constant Value: "android_id"

public static final String BACKGROUND_DATA

Since: API Level 3

Whether background data usage is allowed by the user. See ConnectivityManager for more info.

Constant Value: "background_data"

public static final String BLUETOOTH_ON

Since: API Level 3

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

Constant Value: "bluetooth_on"

public static final String DATA_ROAMING

Since: API Level 3

Whether or not data roaming is enabled. (0 = false, 1 = true)

Constant Value: "data_roaming"

public static final String DEFAULT_INPUT_METHOD

Since: API Level 3

Setting to record the input method used by default, holding the ID of the desired method.

Constant Value: "default_input_method"

public static final String DEVELOPMENT_SETTINGS_ENABLED

Since: API Level 16

Whether user has enabled development settings.

Constant Value: "development_settings_enabled"

public static final String DEVICE_PROVISIONED

Since: API Level 3

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

Constant Value: "device_provisioned"

public static final String ENABLED_ACCESSIBILITY_SERVICES

Since: API Level 4

List of the enabled accessibility providers.

Constant Value: "enabled_accessibility_services"

public static final String ENABLED_INPUT_METHODS

Since: API Level 3

List of input methods that are currently enabled. This is a string containing the IDs of all enabled input methods, each ID separated by ':'.

Constant Value: "enabled_input_methods"

public static final String HTTP_PROXY

Since: API Level 3

Host name and port for global http proxy. Uses ':' seperator for between host and port TODO - deprecate in favor of global_http_proxy_host, etc

Constant Value: "http_proxy"

public static final String INPUT_METHOD_SELECTOR_VISIBILITY

Since: API Level 11

Setting to record the visibility of input method selector

Constant Value: "input_method_selector_visibility"

public static final String INSTALL_NON_MARKET_APPS

Since: API Level 3

Whether the package installer should allow installation of apps downloaded from sources other than Google Play. 1 = allow installing from other sources 0 = only allow installing from Google Play

Constant Value: "install_non_market_apps"

public static final String LOCATION_PROVIDERS_ALLOWED

Since: API Level 3

Comma-separated list of location providers that activities may access.

Constant Value: "location_providers_allowed"

public static final String LOCK_PATTERN_ENABLED

Since: API Level 8

Whether autolock is enabled (0 = false, 1 = true)

Constant Value: "lock_pattern_autolock"

public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED

Since: API Level 8

Whether lock pattern will vibrate as user enters (0 = false, 1 = true)

Constant Value: "lock_pattern_tactile_feedback_enabled"

public static final String LOCK_PATTERN_VISIBLE

Since: API Level 8

Whether lock pattern is visible as user enters (0 = false, 1 = true)

Constant Value: "lock_pattern_visible_pattern"

public static final String LOGGING_ID

Since: API Level 3

This constant is deprecated.
This identifier is poorly initialized and has many collisions. It should not be used.

The Logging ID (a unique 64-bit value) as a hex string. Used as a pseudonymous identifier for logging.

Constant Value: "logging_id"

public static final String NETWORK_PREFERENCE

Since: API Level 3

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

Constant Value: "network_preference"

public static final String PARENTAL_CONTROL_ENABLED

Since: API Level 3

No longer supported.

Constant Value: "parental_control_enabled"

public static final String PARENTAL_CONTROL_LAST_UPDATE

Since: API Level 3

No longer supported.

Constant Value: "parental_control_last_update"

public static final String PARENTAL_CONTROL_REDIRECT_URL

Since: API Level 3

No longer supported.

Constant Value: "parental_control_redirect_url"

public static final String SELECTED_INPUT_METHOD_SUBTYPE

Since: API Level 11

Setting to record the input method subtype used by default, holding the ID of the desired method.

Constant Value: "selected_input_method_subtype"

public static final String SETTINGS_CLASSNAME

Since: API Level 3

Settings classname to launch when Settings is clicked from All Applications. Needed because of user testing between the old and new Settings apps.

Constant Value: "settings_classname"

public static final String SYS_PROP_SETTING_VERSION

Since: API Level 3

Constant Value: "sys.settings_secure_version"

public static final String TOUCH_EXPLORATION_ENABLED

Since: API Level 14

If touch exploration is enabled.

Constant Value: "touch_exploration_enabled"

public static final String TTS_DEFAULT_COUNTRY

Since: API Level 4

This constant is deprecated.
this setting is no longer in use, as of the Ice Cream Sandwich release. Apps should never need to read this setting directly, instead can query the TextToSpeech framework classes for the default locale. getLanguage().

Default text-to-speech country.

Constant Value: "tts_default_country"

public static final String TTS_DEFAULT_LANG

Since: API Level 4

This constant is deprecated.
this setting is no longer in use, as of the Ice Cream Sandwich release. Apps should never need to read this setting directly, instead can query the TextToSpeech framework classes for the default locale. getLanguage().

Default text-to-speech language.

Constant Value: "tts_default_lang"

public static final String TTS_DEFAULT_PITCH

Since: API Level 4

Default text-to-speech engine pitch. 100 = 1x

Constant Value: "tts_default_pitch"

public static final String TTS_DEFAULT_RATE

Since: API Level 4

Default text-to-speech engine speech rate. 100 = 1x

Constant Value: "tts_default_rate"

public static final String TTS_DEFAULT_SYNTH

Since: API Level 4

Default text-to-speech engine.

Constant Value: "tts_default_synth"

public static final String TTS_DEFAULT_VARIANT

Since: API Level 4

This constant is deprecated.
this setting is no longer in use, as of the Ice Cream Sandwich release. Apps should never need to read this setting directly, instead can query the TextToSpeech framework classes for the locale that is in use getLanguage().

Default text-to-speech locale variant.

Constant Value: "tts_default_variant"

public static final String TTS_ENABLED_PLUGINS

Since: API Level 8

Space delimited list of plugin packages that are enabled.

Constant Value: "tts_enabled_plugins"

public static final String TTS_USE_DEFAULTS

Since: API Level 4

This constant is deprecated.
The value of this setting is no longer respected by the framework text to speech APIs as of the Ice Cream Sandwich release.

Setting to always use the default text-to-speech settings regardless of the application settings. 1 = override application settings, 0 = use application settings (if specified).

Constant Value: "tts_use_defaults"

public static final String USB_MASS_STORAGE_ENABLED

Since: API Level 3

USB Mass Storage Enabled

Constant Value: "usb_mass_storage_enabled"

public static final String USE_GOOGLE_MAIL

Since: API Level 3

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

Constant Value: "use_google_mail"

public static final String WIFI_MAX_DHCP_RETRY_COUNT

Since: API Level 3

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.

Constant Value: "wifi_max_dhcp_retry_count"

public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS

Since: API Level 3

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.

Constant Value: "wifi_mobile_data_transition_wakelock_timeout_ms"

public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON

Since: API Level 3

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 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY time.

Constant Value: "wifi_networks_available_notification_on"

public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY

Since: API Level 3

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

Constant Value: "wifi_networks_available_repeat_delay"

public static final String WIFI_NUM_OPEN_NETWORKS_KEPT

Since: API Level 3

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

Constant Value: "wifi_num_open_networks_kept"

public static final String WIFI_ON

Since: API Level 3

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

Constant Value: "wifi_on"

public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE

Since: API Level 3

The acceptable packet loss percentage (range 0 - 100) before trying another AP on the same network.

Constant Value: "wifi_watchdog_acceptable_packet_loss_percentage"

public static final String WIFI_WATCHDOG_AP_COUNT

Since: API Level 3

The number of access points required for a network in order for the watchdog to monitor it.

Constant Value: "wifi_watchdog_ap_count"

public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS

Since: API Level 3

The delay between background checks.

Constant Value: "wifi_watchdog_background_check_delay_ms"

public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED

Since: API Level 3

Whether the Wi-Fi watchdog is enabled for background checking even after it thinks the user has connected to a good access point.

Constant Value: "wifi_watchdog_background_check_enabled"

public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS

Since: API Level 3

The timeout for a background ping

Constant Value: "wifi_watchdog_background_check_timeout_ms"

public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT

Since: API Level 3

The number of initial pings to perform that *may* be ignored if they fail. Again, if these fail, they will *not* be used in packet loss calculation. For example, one network always seemed to time out for the first couple pings, so this is set to 3 by default.

Constant Value: "wifi_watchdog_initial_ignored_ping_count"

public static final String WIFI_WATCHDOG_MAX_AP_CHECKS

Since: API Level 3

The maximum number of access points (per network) to attempt to test. If this number is reached, the watchdog will no longer monitor the initial connection state for the network. This is a safeguard for networks containing multiple APs whose DNS does not respond to pings.

Constant Value: "wifi_watchdog_max_ap_checks"

public static final String WIFI_WATCHDOG_ON

Since: API Level 3

Whether the Wi-Fi watchdog is enabled.

Constant Value: "wifi_watchdog_on"

public static final String WIFI_WATCHDOG_PING_COUNT

Since: API Level 3

The number of pings to test if an access point is a good connection.

Constant Value: "wifi_watchdog_ping_count"

public static final String WIFI_WATCHDOG_PING_DELAY_MS

Since: API Level 3

The delay between pings.

Constant Value: "wifi_watchdog_ping_delay_ms"

public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS

Since: API Level 3

The timeout per ping.

Constant Value: "wifi_watchdog_ping_timeout_ms"

public static final String WIFI_WATCHDOG_WATCH_LIST

Since: API Level 3

A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled.

Constant Value: "wifi_watchdog_watch_list"

Fields

public static final Uri CONTENT_URI

Since: API Level 3

The content:// style URL for this table

Public Constructors

public Settings.Secure ()

Since: API Level 3

Public Methods

public static float getFloat (ContentResolver cr, String name, float def)

Since: API Level 3

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 The ContentResolver to access.
name The name of the setting to retrieve.
def Value to return if the setting is not defined.
Returns
  • The setting's current value, or 'def' if it is not defined or not a valid float.

public static float getFloat (ContentResolver cr, String name)

Since: API Level 3

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 Settings.SettingNotFoundException.

Parameters
cr The ContentResolver to access.
name The name of the setting to retrieve.
Returns
  • The setting's current value.
Throws
Settings.SettingNotFoundException Thrown if a setting by the given name can't be found or the setting value is not a float.

public static int getInt (ContentResolver cr, String name)

Since: API Level 3

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 Settings.SettingNotFoundException.

Parameters
cr The ContentResolver to access.
name The name of the setting to retrieve.
Returns
  • The setting's current value.
Throws
Settings.SettingNotFoundException Thrown if a setting by the given name can't be found or the setting value is not an integer.

public static int getInt (ContentResolver cr, String name, int def)

Since: API Level 3

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 The ContentResolver to access.
name The name of the setting to retrieve.
def Value to return if the setting is not defined.
Returns
  • The setting's current value, or 'def' if it is not defined or not a valid integer.

public static long getLong (ContentResolver cr, String name, long def)

Since: API Level 3

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 The ContentResolver to access.
name The name of the setting to retrieve.
def Value to return if the setting is not defined.
Returns
  • The setting's current value, or 'def' if it is not defined or not a valid long.

public static long getLong (ContentResolver cr, String name)

Since: API Level 3

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 Settings.SettingNotFoundException.

Parameters
cr The ContentResolver to access.
name The name of the setting to retrieve.
Returns
  • The setting's current value.
Throws
Settings.SettingNotFoundException Thrown if a setting by the given name can't be found or the setting value is not an integer.

public static synchronized String getString (ContentResolver resolver, String name)

Since: API Level 3

Look up a name in the database.

Parameters
resolver to access the database with
name to look up in the table
Returns
  • the corresponding value, or null if not present

public static Uri getUriFor (String name)

Since: API Level 3

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

Parameters
name to look up in the table
Returns
  • the corresponding content URI, or null if not present

public static final boolean isLocationProviderEnabled (ContentResolver cr, String provider)

Since: API Level 8

Helper method for determining if a location provider is enabled.

Parameters
cr the content resolver to use
provider the location provider to query
Returns
  • true if the provider is enabled

public static boolean putFloat (ContentResolver cr, String name, float value)

Since: API Level 3

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 The ContentResolver to access.
name The name of the setting to modify.
value The new value for the setting.
Returns
  • true if the value was set, false on database errors

public static boolean putInt (ContentResolver cr, String name, int value)

Since: API Level 3

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 The ContentResolver to access.
name The name of the setting to modify.
value The new value for the setting.
Returns
  • true if the value was set, false on database errors

public static boolean putLong (ContentResolver cr, String name, long value)

Since: API Level 3

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 The ContentResolver to access.
name The name of the setting to modify.
value The new value for the setting.
Returns
  • true if the value was set, false on database errors

public static boolean putString (ContentResolver resolver, String name, String value)

Since: API Level 3

Store a name/value pair into the database.

Parameters
resolver to access the database with
name to store
value to associate with the name
Returns
  • true if the value was set, false on database errors

public static final void setLocationProviderEnabled (ContentResolver cr, String provider, boolean enabled)

Since: API Level 8

Thread-safe method for enabling or disabling a single location provider.

Parameters
cr the content resolver to use
provider the location provider to enable or disable
enabled true if the provider should be enabled