---
title: "Android 获取系统设置参数。"
author: "Java-Object"
date: "2014-05-29T16:34:15Z"
tags: []
categories: ["编程语言"]
slug: "android"
draft: false
lastmod: "2014-05-29T16:34:55Z"
id: 2073529
url: "https://hezd.iteye.com/blog/2073529"
---

转载自：[http://blog.163.com/fang\_wang2005/blog/static/176928073201136105613638/](http://blog.163.com/fang_wang2005/blog/static/176928073201136105613638/)

[如何获取Android系统设置参数](http://www.cnblogs.com/liwqiang/archive/2010/08/08/1795172.html)

下面以获取时间格式为例，来判断时间是24小时制还是12小时制

        ContentResolver cv = this.getContentResolver();  
        String strTimeFormat = android.provider.Settings.System.getString(cv,  
                                           android.provider.Settings.System.TIME\_12\_24);  
          
        if(strTimeFormat.equals("24"))

       {  
              Log.i("activity","24");  
        }

  System的其他参数如下：

 

Constants [String]() [ACCELEROMETER\_ROTATION]() Control whether the accelerometer will be used to change screen orientation. [String]() [ADB\_ENABLED]() *This constant is deprecated. Use `ADB_ENABLED` instead* [String]() [AIRPLANE\_MODE\_ON]() Whether Airplane Mode is on. [String]() [AIRPLANE\_MODE\_RADIOS]() A comma separated list of radios that need to be disabled when airplane mode is on. [String]() [ALARM\_ALERT]() Persistent store for the system-wide default alarm alert. [String]() [ALWAYS\_FINISH\_ACTIVITIES]() If 1, the activity manager will aggressively finish activities and processes as soon as they are no longer needed. [String]() [ANDROID\_ID]() *This constant is deprecated. Use `ANDROID_ID` instead* [String]() [APPEND\_FOR\_LAST\_AUDIBLE]() Appended to various volume related settings to record the previous values before they the settings were affected by a silent/vibrate ringer mode change. [String]() [AUTO\_TIME]() Value to specify if the user prefers the date, time and time zone to be automatically fetched from the network (NITZ). [String]() [AUTO\_TIME\_ZONE]() Value to specify if the user prefers the time zone to be automatically fetched from the network (NITZ). [String]() [BLUETOOTH\_DISCOVERABILITY]() Determines whether remote devices may discover and/or connect to this device. [String]() [BLUETOOTH\_DISCOVERABILITY\_TIMEOUT]() Bluetooth discoverability timeout. [String]() [BLUETOOTH\_ON]() *This constant is deprecated. Use `BLUETOOTH_ON` instead* [String]() [DATA\_ROAMING]() *This constant is deprecated. Use `DATA_ROAMING` instead* [String]() [DATE\_FORMAT]() Date format string mm/dd/yyyy dd/mm/yyyy yyyy/mm/dd [String]() [DEBUG\_APP]() Name of an application package to be debugged. [String]() [DEVICE\_PROVISIONED]() *This constant is deprecated. Use `DEVICE_PROVISIONED` instead* [String]() [DIM\_SCREEN]() Whether or not to dim the screen. [String]() [DTMF\_TONE\_WHEN\_DIALING]() Whether the audible DTMF tones are played by the dialer when dialing. [String]() [END\_BUTTON\_BEHAVIOR]() What happens when the user presses the end call button if they're not on a call. [String]() [FONT\_SCALE]() Scaling factor for fonts, float. [String]() [HAPTIC\_FEEDBACK\_ENABLED]() Whether the haptic feedback (long presses, ...) are enabled. [String]() [HTTP\_PROXY]() *This constant is deprecated. Use `HTTP_PROXY` instead* [String]() [INSTALL\_NON\_MARKET\_APPS]() *This constant is deprecated. Use `INSTALL_NON_MARKET_APPS` instead* [String]() [LOCATION\_PROVIDERS\_ALLOWED]() *This constant is deprecated. Use `LOCATION_PROVIDERS_ALLOWED` instead* [String]() [LOCK\_PATTERN\_ENABLED]() *This constant is deprecated. Use `LOCK_PATTERN_ENABLED` instead* [String]() [LOCK\_PATTERN\_TACTILE\_FEEDBACK\_ENABLED]() *This constant is deprecated. Use `LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED` instead* [String]() [LOCK\_PATTERN\_VISIBLE]() *This constant is deprecated. Use `LOCK_PATTERN_VISIBLE` instead* [String]() [LOGGING\_ID]() *This constant is deprecated. Use `LOGGING_ID` instead* [String]() [MODE\_RINGER]() Ringer mode. [String]() [MODE\_RINGER\_STREAMS\_AFFECTED]() Determines which streams are affected by ringer mode changes. [String]() [MUTE\_STREAMS\_AFFECTED]() Determines which streams are affected by mute. [String]() [NETWORK\_PREFERENCE]() *This constant is deprecated. Use `NETWORK_PREFERENCE` instead* [String]() [NEXT\_ALARM\_FORMATTED]() A formatted string of the next alarm that is set, or the empty string if there is no alarm set. [String]() [NOTIFICATION\_SOUND]() Persistent store for the system-wide default notification sound. [String]() [PARENTAL\_CONTROL\_ENABLED]() *This constant is deprecated. Use `PARENTAL_CONTROL_ENABLED` instead* [String]() [PARENTAL\_CONTROL\_LAST\_UPDATE]() *This constant is deprecated. Use `PARENTAL_CONTROL_LAST_UPDATE` instead* [String]() [PARENTAL\_CONTROL\_REDIRECT\_URL]() *This constant is deprecated. Use `PARENTAL_CONTROL_REDIRECT_URL` instead* [String]() [RADIO\_BLUETOOTH]() Constant for use in AIRPLANE\_MODE\_RADIOS to specify Bluetooth radio. [String]() [RADIO\_CELL]() Constant for use in AIRPLANE\_MODE\_RADIOS to specify Cellular radio. [String]() [RADIO\_WIFI]() Constant for use in AIRPLANE\_MODE\_RADIOS to specify Wi-Fi radio. [String]() [RINGTONE]() Persistent store for the system-wide default ringtone URI. [String]() [SCREEN\_BRIGHTNESS]() The screen backlight brightness between 0 and 255. [String]() [SCREEN\_BRIGHTNESS\_MODE]() Control whether to enable automatic brightness mode. int [SCREEN\_BRIGHTNESS\_MODE\_AUTOMATIC]() SCREEN\_BRIGHTNESS\_MODE value for manual mode. int [SCREEN\_BRIGHTNESS\_MODE\_MANUAL]() SCREEN\_BRIGHTNESS\_MODE value for manual mode. [String]() [SCREEN\_OFF\_TIMEOUT]() The timeout before the screen turns off. [String]() [SETTINGS\_CLASSNAME]() *This constant is deprecated. Use `SETTINGS_CLASSNAME` instead* [String]() [SETUP\_WIZARD\_HAS\_RUN]() Whether the setup wizard has been run before (on first boot), or if it still needs to be run. [String]() [SHOW\_GTALK\_SERVICE\_STATUS]()   [String]() [SHOW\_PROCESSES]() Control whether the process CPU usage meter should be shown. [String]() [SHOW\_WEB\_SUGGESTIONS]() *This constant is deprecated. Each application that shows web suggestions should have its own setting for this.* [String]() [SOUND\_EFFECTS\_ENABLED]() Whether the sounds effects (key clicks, lid open ...) are enabled. [String]() [STAY\_ON\_WHILE\_PLUGGED\_IN]() Whether we keep the device on while the device is plugged in. [String]() [SYS\_PROP\_SETTING\_VERSION]()   [String]() [TEXT\_AUTO\_CAPS]() Setting to enable Auto Caps in text editors. [String]() [TEXT\_AUTO\_PUNCTUATE]() Setting to enable Auto Punctuate in text editors. [String]() [TEXT\_AUTO\_REPLACE]() Setting to enable Auto Replace (AutoText) in text editors. [String]() [TEXT\_SHOW\_PASSWORD]() Setting to showing password characters in text editors. [String]() [TIME\_12\_24]() Display times as 12 or 24 hours 12 24 [String]() [TRANSITION\_ANIMATION\_SCALE]() Scaling factor for activity transition animations. [String]() [USB\_MASS\_STORAGE\_ENABLED]() *This constant is deprecated. Use `USB_MASS_STORAGE_ENABLED` instead* [String]() [USER\_ROTATION]() Default screen rotation when no other policy applies. [String]() [USE\_GOOGLE\_MAIL]() *This constant is deprecated. Use `USE_GOOGLE_MAIL` instead* [String]() [VIBRATE\_ON]() Whether vibrate is on for different events. [String]() [VOLUME\_ALARM]() Alarm volume. [String]() [VOLUME\_BLUETOOTH\_SCO]() Bluetooth Headset volume. [String]() [VOLUME\_MUSIC]() Music/media/gaming volume. [String]() [VOLUME\_NOTIFICATION]() Notification volume. [String]() [VOLUME\_RING]() Ringer volume. [String]() [VOLUME\_SYSTEM]() System/notifications volume. [String]() [VOLUME\_VOICE]() Voice call volume. [String]() [WAIT\_FOR\_DEBUGGER]() If 1, when launching DEBUG\_APP it will wait for the debugger before starting user code. [String]() [WALLPAPER\_ACTIVITY]() Name of activity to use for wallpaper on the home screen. [String]() [WIFI\_MAX\_DHCP\_RETRY\_COUNT]() *This constant is deprecated. Use `WIFI_MAX_DHCP_RETRY_COUNT` instead* [String]() [WIFI\_MOBILE\_DATA\_TRANSITION\_WAKELOCK\_TIMEOUT\_MS]() *This constant is deprecated. Use`WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS` instead* [String]() [WIFI\_NETWORKS\_AVAILABLE\_NOTIFICATION\_ON]() *This constant is deprecated. Use `WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON` instead* [String]() [WIFI\_NETWORKS\_AVAILABLE\_REPEAT\_DELAY]() *This constant is deprecated. Use `WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY` instead* [String]() [WIFI\_NUM\_OPEN\_NETWORKS\_KEPT]() *This constant is deprecated. Use `WIFI_NUM_OPEN_NETWORKS_KEPT` instead* [String]() [WIFI\_ON]() *This constant is deprecated. Use `WIFI_ON` instead* [String]() [WIFI\_SLEEP\_POLICY]() 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). int [WIFI\_SLEEP\_POLICY\_DEFAULT]() 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. int [WIFI\_SLEEP\_POLICY\_NEVER]() Value for `WIFI_SLEEP_POLICY` to never go to sleep. int [WIFI\_SLEEP\_POLICY\_NEVER\_WHILE\_PLUGGED]() 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. [String]() [WIFI\_STATIC\_DNS1]() If using static IP, the primary DNS's IP address. [String]() [WIFI\_STATIC\_DNS2]() If using static IP, the secondary DNS's IP address. [String]() [WIFI\_STATIC\_GATEWAY]() If using static IP, the gateway's IP address. [String]() [WIFI\_STATIC\_IP]() The static IP address. [String]() [WIFI\_STATIC\_NETMASK]() If using static IP, the net mask. [String]() [WIFI\_USE\_STATIC\_IP]() Whether to use static IP and other static network attributes. [String]() [WIFI\_WATCHDOG\_ACCEPTABLE\_PACKET\_LOSS\_PERCENTAGE]() *This constant is deprecated. Use`WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE` instead* [String]() [WIFI\_WATCHDOG\_AP\_COUNT]() *This constant is deprecated. Use `WIFI_WATCHDOG_AP_COUNT` instead* [String]() [WIFI\_WATCHDOG\_BACKGROUND\_CHECK\_DELAY\_MS]() *This constant is deprecated. Use `WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS` instead* [String]() [WIFI\_WATCHDOG\_BACKGROUND\_CHECK\_ENABLED]() *This constant is deprecated. Use `WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED` instead* [String]() [WIFI\_WATCHDOG\_BACKGROUND\_CHECK\_TIMEOUT\_MS]() *This constant is deprecated. Use `WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS`instead* [String]() [WIFI\_WATCHDOG\_INITIAL\_IGNORED\_PING\_COUNT]() *This constant is deprecated. Use `WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT`instead* [String]() [WIFI\_WATCHDOG\_MAX\_AP\_CHECKS]() *This constant is deprecated. Use `WIFI_WATCHDOG_MAX_AP_CHECKS` instead* [String]() [WIFI\_WATCHDOG\_ON]() *This constant is deprecated. Use `WIFI_WATCHDOG_ON` instead* [String]() [WIFI\_WATCHDOG\_PING\_COUNT]() *This constant is deprecated. Use `WIFI_WATCHDOG_PING_COUNT` instead* [String]() [WIFI\_WATCHDOG\_PING\_DELAY\_MS]() *This constant is deprecated. Use `WIFI_WATCHDOG_PING_DELAY_MS` instead* [String]() [WIFI\_WATCHDOG\_PING\_TIMEOUT\_MS]() *This constant is deprecated. Use `WIFI_WATCHDOG_PING_TIMEOUT_MS` instead* [String]() [WINDOW\_ANIMATION\_SCALE]() Scaling factor for normal window animations.