System

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

System settings, containing miscellaneous system preferences. This table holds simple name/value pairs. There are convenience functions for accessing individual settings entries.

Summary

Constants
static String

Control whether the accelerometer will be used to change screen orientation.

static String

static String

static String

static String

Persistent store for the system-wide default alarm alert.

static String

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

static String

static String

Scaling factor for Animator-based animations.

static String

static String


Requires API level 11 (Android 3.0, Honeycomb)

static String

Determines whether remote devices may discover and/or connect to this device.

static String

Bluetooth discoverability timeout.

static String

static String

static String

Date format string mm/dd/yyyy dd/mm/yyyy yyyy/mm/dd

static String

Name of an application package to be debugged.

static String

static String

Whether or not to dim the screen.

static String

CDMA only settings DTMF tone type played by the dialer when dialing.

static String

Whether the audible DTMF tones are played by the dialer when dialing.

static String

What happens when the user presses the end call button if they're not on a call.

static String

Scaling factor for fonts, float.

static String

Whether haptic feedback (Vibrate on tap) is enabled.

static String

static String

static String

static String

static String


Requires API level 3 (Android 1.5, Cupcake)

static String

static String

static String

static String

Determines which streams are affected by ringer and zen mode changes.

static String

Determines which streams are affected by mute.

static String

static String

A formatted string of the next alarm that is set, or the empty string if there is no alarm set.

static String

Persistent store for the system-wide default notification sound.

static String

static String

static String

static String

static String

static String


Requires API level 14 (Android 4.0, IceCreamSandwich)

static String

static String

Persistent store for the system-wide default ringtone URI.

static String

The screen backlight brightness between 0 and 255.

static String

Control whether to enable automatic brightness mode.

static Int

SCREEN_BRIGHTNESS_MODE value for automatic mode.

static Int

SCREEN_BRIGHTNESS_MODE value for manual mode.

static String

The amount of time in milliseconds before the device goes to sleep or begins to dream after a period of inactivity.

static String

static String

Whether the setup wizard has been run before (on first boot), or if it still needs to be run.

static String

static String

Control whether the process CPU usage meter should be shown.

static String


Requires API level 4 (Android 1.6, Donut)

static String

Whether the sounds effects (key clicks, lid open ...) are enabled.

static String

static String

Setting to enable Auto Caps in text editors.

static String

Setting to enable Auto Punctuate in text editors.

static String

Setting to enable Auto Replace (AutoText) in text editors.

static String

Setting to showing password characters in text editors.

static String

Display times as 12 or 24 hours 12 24

static String

Scaling factor for activity transition animations.

static String

static String

Default screen rotation when no other policy applies.

static String

static String

Whether vibrate is on for different events.

static String

Whether the phone vibrates when it is ringing due to an incoming call.

static String

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

static String

Name of activity to use for wallpaper on the home screen.

static String


Requires API level 3 (Android 1.5, Cupcake)

static String


Requires API level 3 (Android 1.5, Cupcake)

static String

static String

static String

static String

static String


Requires API level 3 (Android 1.5, Cupcake)

static Int


Requires API level 3 (Android 1.5, Cupcake)

static Int


Requires API level 3 (Android 1.5, Cupcake)

static Int


Requires API level 3 (Android 1.5, Cupcake)

static String

If using static IP, the primary DNS's IP address.

static String

If using static IP, the secondary DNS's IP address.

static String

If using static IP, the gateway's IP address.

static String

The static IP address.

static String

If using static IP, the net mask.

static String

Whether to use static IP and other static network attributes.

static String

static String

static String

static String

static String

static String

static String

static String

static String

static String

static String

static String

Scaling factor for normal window animations.

Inherited constants
Public constructors

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

Look up a name in the database.

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

Store a name/value pair into 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 Int
getInt(cr: ContentResolver!, name: String!, def: Int)

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

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

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

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

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

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

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

static Long

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

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

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

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

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

static Float

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

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

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

static Unit

Convenience function to read all of the current configuration-related settings into a Configuration object.

static Boolean

Convenience function to write a batch of configuration-related settings from a Configuration object.

static Boolean

static Unit

static Boolean
canWrite(context: Context!)

Checks if the specified app can modify system settings.

Inherited functions
Properties
static Uri!

The content:// style URL for this table

static Uri!

A Uri that will point to the current default alarm alert at any given time.

static Uri!

A Uri that will point to the current default notification sound at any given time.

static Uri!

A Uri that will point to the current default ringtone at any given time.

Constants

ACCELEROMETER_ROTATION

added in API level 3
static val ACCELEROMETER_ROTATION: String

Control whether the accelerometer will be used to change screen orientation. If 0, it will not be used unless explicitly requested by the application; if 1, it will be used by default unless explicitly disabled by the application.
Requires API level 3 (Android 1.5, Cupcake)

Value: "accelerometer_rotation"

ADB_ENABLED

static val ADB_ENABLED: String
Value: "adb_enabled"

AIRPLANE_MODE_ON

static val AIRPLANE_MODE_ON: String
Value: "airplane_mode_on"

AIRPLANE_MODE_RADIOS

static val AIRPLANE_MODE_RADIOS: String
Value: "airplane_mode_radios"

ALARM_ALERT

added in API level 5
static val ALARM_ALERT: String

Persistent store for the system-wide default alarm alert.
Requires API level 5 (Android 2.0, Eclair)

Value: "alarm_alert"

ALWAYS_FINISH_ACTIVITIES

static val ALWAYS_FINISH_ACTIVITIES: String

If 1, 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"

ANDROID_ID

static val ANDROID_ID: String
Value: "android_id"

ANIMATOR_DURATION_SCALE

added in API level 16
static val ANIMATOR_DURATION_SCALE: String

Scaling factor for Animator-based animations. This affects both the start delay and duration of all such animations. Setting to 0 will cause animations to end immediately. The default value is 1.
Requires API level 16 (Android 4.1, Jelly Bean)

Value: "animator_duration_scale"

AUTO_TIME

static val AUTO_TIME: String
Value: "auto_time"

AUTO_TIME_ZONE

added in API level 11
static val AUTO_TIME_ZONE: String


Requires API level 11 (Android 3.0, Honeycomb)

Value: "auto_time_zone"

BLUETOOTH_DISCOVERABILITY

static val BLUETOOTH_DISCOVERABILITY: String

Determines whether remote devices may discover and/or connect to this device.

Type: INT

2 -- discoverable and connectable 1 -- connectable but not discoverable 0 -- neither connectable nor discoverable
Value: "bluetooth_discoverability"

BLUETOOTH_DISCOVERABILITY_TIMEOUT

static val BLUETOOTH_DISCOVERABILITY_TIMEOUT: String

Bluetooth discoverability timeout. If this value is nonzero, then Bluetooth becomes discoverable for a certain number of seconds, after which is becomes simply connectable. The value is in seconds.

Value: "bluetooth_discoverability_timeout"

BLUETOOTH_ON

static val BLUETOOTH_ON: String
Value: "bluetooth_on"

DATA_ROAMING

static val DATA_ROAMING: String
Value: "data_roaming"

DATE_FORMAT

static val DATE_FORMAT: String

Date format string mm/dd/yyyy dd/mm/yyyy yyyy/mm/dd

Value: "date_format"

DEBUG_APP

static val DEBUG_APP: String

Name of an application package to be debugged.

Value: "debug_app"

DEVICE_PROVISIONED

static val DEVICE_PROVISIONED: String
Value: "device_provisioned"

DIM_SCREEN

static val DIM_SCREEN: String

Whether or not to dim the screen. 0=no 1=yes

Value: "dim_screen"

DTMF_TONE_TYPE_WHEN_DIALING

added in API level 23
static val DTMF_TONE_TYPE_WHEN_DIALING: String

CDMA only settings DTMF tone type played by the dialer when dialing. 0 = Normal 1 = Long
Requires API level 23 (Android 6.0, Marshmallow)

Value: "dtmf_tone_type"

DTMF_TONE_WHEN_DIALING

static val DTMF_TONE_WHEN_DIALING: String

Whether the audible DTMF tones are played by the dialer when dialing. The value is boolean (1 or 0).

Value: "dtmf_tone"

END_BUTTON_BEHAVIOR

static val END_BUTTON_BEHAVIOR: String

What happens when the user presses the end call button if they're not on a call.
Values:
0 - The end button does nothing.
1 - The end button goes to the home screen.
2 - The end button puts the device to sleep and locks the keyguard.
3 - The end button goes to the home screen. If the user is already on the home screen, it puts the device to sleep.

Value: "end_button_behavior"

FONT_SCALE

static val FONT_SCALE: String

Scaling factor for fonts, float.

Value: "font_scale"

HAPTIC_FEEDBACK_ENABLED

added in API level 3
static val HAPTIC_FEEDBACK_ENABLED: String

Whether haptic feedback (Vibrate on tap) is enabled. The value is boolean (1 or 0).
Requires API level 3 (Android 1.5, Cupcake)

Value: "haptic_feedback_enabled"

HTTP_PROXY

static val HTTP_PROXY: String
Value: "http_proxy"

INSTALL_NON_MARKET_APPS

static val INSTALL_NON_MARKET_APPS: String
Value: "install_non_market_apps"

LOCATION_PROVIDERS_ALLOWED

static val LOCATION_PROVIDERS_ALLOWED: String
Value: "location_providers_allowed"

LOCK_PATTERN_ENABLED

static val LOCK_PATTERN_ENABLED: String
Value: "lock_pattern_autolock"

LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED

added in API level 3
static val LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED: String


Requires API level 3 (Android 1.5, Cupcake)

Value: "lock_pattern_tactile_feedback_enabled"

LOCK_PATTERN_VISIBLE

static val LOCK_PATTERN_VISIBLE: String
Value: "lock_pattern_visible_pattern"

LOGGING_ID

static val LOGGING_ID: String
Value: "logging_id"

MODE_RINGER

static val MODE_RINGER: String
Value: "mode_ringer"

MODE_RINGER_STREAMS_AFFECTED

static val MODE_RINGER_STREAMS_AFFECTED: String

Determines which streams are affected by ringer and zen mode changes. The stream type's bit should be set to 1 if it should be muted when going into an inaudible ringer mode.

Value: "mode_ringer_streams_affected"

MUTE_STREAMS_AFFECTED

static val MUTE_STREAMS_AFFECTED: String

Determines which streams are affected by mute. The stream type's bit should be set to 1 if it should be muted when a mute request is received.

Value: "mute_streams_affected"

NETWORK_PREFERENCE

static val NETWORK_PREFERENCE: String
Value: "network_preference"

NEXT_ALARM_FORMATTED

static val NEXT_ALARM_FORMATTED: String

A formatted string of the next alarm that is set, or the empty string if there is no alarm set.

Value: "next_alarm_formatted"

NOTIFICATION_SOUND

static val NOTIFICATION_SOUND: String

Persistent store for the system-wide default notification sound.

Value: "notification_sound"

PARENTAL_CONTROL_ENABLED

static val PARENTAL_CONTROL_ENABLED: String
Value: "parental_control_enabled"

PARENTAL_CONTROL_LAST_UPDATE

static val PARENTAL_CONTROL_LAST_UPDATE: String
Value: "parental_control_last_update"

PARENTAL_CONTROL_REDIRECT_URL

static val PARENTAL_CONTROL_REDIRECT_URL: String
Value: "parental_control_redirect_url"

RADIO_BLUETOOTH

static val RADIO_BLUETOOTH: String
Value: "bluetooth"

RADIO_CELL

static val RADIO_CELL: String
Value: "cell"

RADIO_NFC

added in API level 14
static val RADIO_NFC: String


Requires API level 14 (Android 4.0, IceCreamSandwich)

Value: "nfc"

RADIO_WIFI

static val RADIO_WIFI: String
Value: "wifi"

RINGTONE

static val RINGTONE: String

Persistent store for the system-wide default ringtone URI.

If you need to play the default ringtone at any given time, it is recommended you give #DEFAULT_RINGTONE_URI to the media player. It will resolve to the set default ringtone at the time of playing.

Value: "ringtone"

SCREEN_BRIGHTNESS

static val SCREEN_BRIGHTNESS: String

The screen backlight brightness between 0 and 255.

Value: "screen_brightness"

SCREEN_BRIGHTNESS_MODE

added in API level 8
static val SCREEN_BRIGHTNESS_MODE: String

Control whether to enable automatic brightness mode.
Requires API level 8 (Android 2.2, Froyo)

Value: "screen_brightness_mode"

SCREEN_BRIGHTNESS_MODE_AUTOMATIC

added in API level 8
static val SCREEN_BRIGHTNESS_MODE_AUTOMATIC: Int

SCREEN_BRIGHTNESS_MODE value for automatic mode.
Requires API level 8 (Android 2.2, Froyo)

Value: 1

SCREEN_BRIGHTNESS_MODE_MANUAL

added in API level 8
static val SCREEN_BRIGHTNESS_MODE_MANUAL: Int

SCREEN_BRIGHTNESS_MODE value for manual mode.
Requires API level 8 (Android 2.2, Froyo)

Value: 0

SCREEN_OFF_TIMEOUT

static val SCREEN_OFF_TIMEOUT: String

The amount of time in milliseconds before the device goes to sleep or begins to dream after a period of inactivity. This value is also known as the user activity timeout period since the screen isn't necessarily turned off when it expires.

This value is bounded by maximum timeout set by android.app.admin.DevicePolicyManager#setMaximumTimeToLock(ComponentName, long).

Value: "screen_off_timeout"

SETTINGS_CLASSNAME

static val SETTINGS_CLASSNAME: String
Value: "settings_classname"

SETUP_WIZARD_HAS_RUN

static val SETUP_WIZARD_HAS_RUN: String

Whether the setup wizard has been run before (on first boot), or if it still needs to be run. nonzero = it has been run in the past 0 = it has not been run in the past

Value: "setup_wizard_has_run"

SHOW_GTALK_SERVICE_STATUS

static val SHOW_GTALK_SERVICE_STATUS: String
Value: "SHOW_GTALK_SERVICE_STATUS"

SHOW_PROCESSES

static val SHOW_PROCESSES: String

Control whether the process CPU usage meter should be shown.

Value: "show_processes"

SHOW_WEB_SUGGESTIONS

added in API level 4
static val SHOW_WEB_SUGGESTIONS: String


Requires API level 4 (Android 1.6, Donut)

Value: "show_web_suggestions"

SOUND_EFFECTS_ENABLED

static val SOUND_EFFECTS_ENABLED: String

Whether the sounds effects (key clicks, lid open ...) are enabled. The value is boolean (1 or 0).

Value: "sound_effects_enabled"

STAY_ON_WHILE_PLUGGED_IN

static val STAY_ON_WHILE_PLUGGED_IN: String
Value: "stay_on_while_plugged_in"

TEXT_AUTO_CAPS

static val TEXT_AUTO_CAPS: String

Setting to enable Auto Caps in text editors. 1 = On, 0 = Off

Value: "auto_caps"

TEXT_AUTO_PUNCTUATE

static val TEXT_AUTO_PUNCTUATE: String

Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This feature converts two spaces to a "." and space.

Value: "auto_punctuate"

TEXT_AUTO_REPLACE

static val TEXT_AUTO_REPLACE: String

Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off

Value: "auto_replace"

TEXT_SHOW_PASSWORD

static val TEXT_SHOW_PASSWORD: String

Setting to showing password characters in text editors. 1 = On, 0 = Off

Value: "show_password"

TIME_12_24

static val TIME_12_24: String

Display times as 12 or 24 hours 12 24

Value: "time_12_24"

TRANSITION_ANIMATION_SCALE

static val TRANSITION_ANIMATION_SCALE: String

Scaling factor for activity transition animations. Setting to 0 will disable window animations.

Value: "transition_animation_scale"

USB_MASS_STORAGE_ENABLED

static val USB_MASS_STORAGE_ENABLED: String
Value: "usb_mass_storage_enabled"

USER_ROTATION

added in API level 11
static val USER_ROTATION: String

Default screen rotation when no other policy applies. When #ACCELEROMETER_ROTATION is zero and no on-screen Activity expresses a preference, this rotation value will be used. Must be one of the Surface rotation constants.
Requires API level 11 (Android 3.0, Honeycomb)

Value: "user_rotation"

USE_GOOGLE_MAIL

static val USE_GOOGLE_MAIL: String
Value: "use_google_mail"

VIBRATE_ON

static val VIBRATE_ON: String

Whether vibrate is on for different events. This is used internally, changing this value will not change the vibrate. See AudioManager.

Value: "vibrate_on"

VIBRATE_WHEN_RINGING

added in API level 23
static val VIBRATE_WHEN_RINGING: String

Whether the phone vibrates when it is ringing due to an incoming call. This will be used by Phone and Setting apps; it shouldn't affect other apps. The value is boolean (1 or 0). Note: this is not same as "vibrate on ring", which had been available until ICS. It was about AudioManager's setting and thus affected all the applications which relied on the setting, while this is purely about the vibration setting for incoming calls.
Requires API level 23 (Android 6.0, Marshmallow)

Value: "vibrate_when_ringing"

WAIT_FOR_DEBUGGER

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"

WALLPAPER_ACTIVITY

static val WALLPAPER_ACTIVITY: String

Name of activity to use for wallpaper on the home screen.

Value: "wallpaper_activity"

WIFI_MAX_DHCP_RETRY_COUNT

added in API level 3
static val WIFI_MAX_DHCP_RETRY_COUNT: String


Requires API level 3 (Android 1.5, Cupcake)

Value: "wifi_max_dhcp_retry_count"

WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS

added in API level 3
static val WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS: String


Requires API level 3 (Android 1.5, Cupcake)

Value: "wifi_mobile_data_transition_wakelock_timeout_ms"

WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON

static val WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON: String
Value: "wifi_networks_available_notification_on"

WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY

static val WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY: String
Value: "wifi_networks_available_repeat_delay"

WIFI_NUM_OPEN_NETWORKS_KEPT

static val WIFI_NUM_OPEN_NETWORKS_KEPT: String
Value: "wifi_num_open_networks_kept"

WIFI_ON

static val WIFI_ON: String
Value: "wifi_on"

WIFI_SLEEP_POLICY

added in API level 3
static val WIFI_SLEEP_POLICY: String


Requires API level 3 (Android 1.5, Cupcake)

Value: "wifi_sleep_policy"

WIFI_SLEEP_POLICY_DEFAULT

added in API level 3
static val WIFI_SLEEP_POLICY_DEFAULT: Int


Requires API level 3 (Android 1.5, Cupcake)

Value: 0

WIFI_SLEEP_POLICY_NEVER

added in API level 3
static val WIFI_SLEEP_POLICY_NEVER: Int


Requires API level 3 (Android 1.5, Cupcake)

Value: 2

WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED

added in API level 3
static val WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED: Int


Requires API level 3 (Android 1.5, Cupcake)

Value: 1

WIFI_STATIC_DNS1

static val WIFI_STATIC_DNS1: String

If using static IP, the primary DNS's IP address.

Example: "192.168.1.1"

Value: "wifi_static_dns1"

WIFI_STATIC_DNS2

static val WIFI_STATIC_DNS2: String

If using static IP, the secondary DNS's IP address.

Example: "192.168.1.2"

Value: "wifi_static_dns2"

WIFI_STATIC_GATEWAY

static val WIFI_STATIC_GATEWAY: String

If using static IP, the gateway's IP address.

Example: "192.168.1.1"

Value: "wifi_static_gateway"

WIFI_STATIC_IP

static val WIFI_STATIC_IP: String

The static IP address.

Example: "192.168.1.51"

Value: "wifi_static_ip"

WIFI_STATIC_NETMASK

static val WIFI_STATIC_NETMASK: String

If using static IP, the net mask.

Example: "255.255.255.0"

Value: "wifi_static_netmask"

WIFI_USE_STATIC_IP

static val WIFI_USE_STATIC_IP: String

Whether to use static IP and other static network attributes.

Set to 1 for true and 0 for false.

Value: "wifi_use_static_ip"

WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE

static val WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE: String
Value: "wifi_watchdog_acceptable_packet_loss_percentage"

WIFI_WATCHDOG_AP_COUNT

static val WIFI_WATCHDOG_AP_COUNT: String
Value: "wifi_watchdog_ap_count"

WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS

static val WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS: String
Value: "wifi_watchdog_background_check_delay_ms"

WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED

static val WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED: String
Value: "wifi_watchdog_background_check_enabled"

WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS

static val WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS: String
Value: "wifi_watchdog_background_check_timeout_ms"

WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT

static val WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT: String
Value: "wifi_watchdog_initial_ignored_ping_count"

WIFI_WATCHDOG_MAX_AP_CHECKS

static val WIFI_WATCHDOG_MAX_AP_CHECKS: String
Value: "wifi_watchdog_max_ap_checks"

WIFI_WATCHDOG_ON

static val WIFI_WATCHDOG_ON: String
Value: "wifi_watchdog_on"

WIFI_WATCHDOG_PING_COUNT

static val WIFI_WATCHDOG_PING_COUNT: String
Value: "wifi_watchdog_ping_count"

WIFI_WATCHDOG_PING_DELAY_MS

static val WIFI_WATCHDOG_PING_DELAY_MS: String
Value: "wifi_watchdog_ping_delay_ms"

WIFI_WATCHDOG_PING_TIMEOUT_MS

static val WIFI_WATCHDOG_PING_TIMEOUT_MS: String
Value: "wifi_watchdog_ping_timeout_ms"

WINDOW_ANIMATION_SCALE

static val WINDOW_ANIMATION_SCALE: String

Scaling factor for normal window animations. Setting to 0 will disable window animations.

Value: "window_animation_scale"

Public constructors

<init>

System()

Public methods

getString

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

Look up a name in the database.

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

putString

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 ContentResolver!: to store
value ContentResolver!: to associate with the name
Return
Boolean: true if the value was set, false on database errors

getUriFor

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

getInt

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

Convenience function for retrieving a single system 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 ContentResolver!: The name of the setting to retrieve.
def ContentResolver!: 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.

getInt

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

Convenience function for retrieving a single system 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 ContentResolver!: The name of the setting to retrieve.
Return
Int: The setting's current value.
Exceptions
SettingNotFoundException Thrown if a setting by the given name can't be found or the setting value is not an integer.

putInt

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

getLong

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

Convenience function for retrieving a single system 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.
Requires API level 3 (Android 1.5, Cupcake)

Parameters
cr ContentResolver!: The ContentResolver to access.
name ContentResolver!: The name of the setting to retrieve.
def ContentResolver!: 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.

getLong

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

Convenience function for retrieving a single system 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.
Requires API level 3 (Android 1.5, Cupcake)

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

putLong

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

Convenience function for updating a single 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.
Requires API level 3 (Android 1.5, Cupcake)

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

getFloat

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

Convenience function for retrieving a single system 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 ContentResolver!: The name of the setting to retrieve.
def ContentResolver!: 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.

getFloat

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

Convenience function for retrieving a single system 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 ContentResolver!: The name of the setting to retrieve.
Return
Float: The setting's current value.
Exceptions
SettingNotFoundException Thrown if a setting by the given name can't be found or the setting value is not a float.

putFloat

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

getConfiguration

static fun getConfiguration(cr: ContentResolver!, outConfig: Configuration!): Unit

Convenience function to read all of the current configuration-related settings into a Configuration object.

Parameters
cr ContentResolver!: The ContentResolver to access.
outConfig ContentResolver!: Where to place the configuration settings.

putConfiguration

static fun putConfiguration(cr: ContentResolver!, config: Configuration!): Boolean

Convenience function to write a batch of configuration-related settings from a Configuration object.

Parameters
cr ContentResolver!: The ContentResolver to access.
config ContentResolver!: The settings to write.
Return
Boolean: true if the values were set, false on database errors

getShowGTalkServiceStatus

static fun getShowGTalkServiceStatus(cr: ContentResolver!): Boolean

setShowGTalkServiceStatus

static fun setShowGTalkServiceStatus(cr: ContentResolver!, flag: Boolean): Unit

canWrite

added in API level 23
static fun canWrite(context: Context!): Boolean

Checks if the specified app can modify system settings. As of API level 23, an app cannot modify system settings unless it declares the android.Manifest.permission#WRITE_SETTINGS permission in its manifest, and the user specifically grants the app this capability. To prompt the user to grant this approval, the app must send an intent with the action , which causes the system to display a permission management screen.
Requires API level 23 (Android 6.0, Marshmallow)

Parameters
context Context!: App context.
Return
Boolean: true if the calling app can write to system settings, false otherwise

Properties

CONTENT_URI

static val CONTENT_URI: Uri!

The content:// style URL for this table

DEFAULT_ALARM_ALERT_URI

added in API level 5
static val DEFAULT_ALARM_ALERT_URI: Uri!

A Uri that will point to the current default alarm alert at any given time.
Requires API level 5 (Android 2.0, Eclair)

DEFAULT_NOTIFICATION_URI

static val DEFAULT_NOTIFICATION_URI: Uri!

A Uri that will point to the current default notification sound at any given time.

DEFAULT_RINGTONE_URI

static val DEFAULT_RINGTONE_URI: Uri!

A Uri that will point to the current default ringtone at any given time.

If the current default ringtone is in the DRM provider and the caller does not have permission, the exception will be a FileNotFoundException.