当前位置: 代码迷 >> Android >> Android 获取系统设置参数
  详细解决方案

Android 获取系统设置参数

热度:56   发布时间:2016-04-28 05:25:30.0
Android 获取系统设置参数。
转载自:http://blog.163.com/fang_wang2005/blog/static/176928073201136105613638/
如何获取Android系统设置参数
下面以获取时间格式为例,来判断时间是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
StringACCELEROMETER_ROTATIONControl whether the accelerometer will be used to change screen orientation.
StringADB_ENABLEDThis constant is deprecated. Use?ADB_ENABLED?instead
StringAIRPLANE_MODE_ONWhether Airplane Mode is on.
StringAIRPLANE_MODE_RADIOSA comma separated list of radios that need to be disabled when airplane mode is on.
StringALARM_ALERTPersistent store for the system-wide default alarm alert.
StringALWAYS_FINISH_ACTIVITIESIf 1, the activity manager will aggressively finish activities and processes as soon as they are no longer needed.
StringANDROID_IDThis constant is deprecated. Use?ANDROID_ID?instead
StringAPPEND_FOR_LAST_AUDIBLEAppended to various volume related settings to record the previous values before they the settings were affected by a silent/vibrate ringer mode change.
StringAUTO_TIMEValue to specify if the user prefers the date, time and time zone to be automatically fetched from the network (NITZ).
StringAUTO_TIME_ZONEValue to specify if the user prefers the time zone to be automatically fetched from the network (NITZ).
StringBLUETOOTH_DISCOVERABILITYDetermines whether remote devices may discover and/or connect to this device.
StringBLUETOOTH_DISCOVERABILITY_TIMEOUTBluetooth discoverability timeout.
StringBLUETOOTH_ONThis constant is deprecated. Use?BLUETOOTH_ON?instead
StringDATA_ROAMINGThis constant is deprecated. Use?DATA_ROAMING?instead
StringDATE_FORMATDate format string mm/dd/yyyy dd/mm/yyyy yyyy/mm/dd
StringDEBUG_APPName of an application package to be debugged.
StringDEVICE_PROVISIONEDThis constant is deprecated. Use?DEVICE_PROVISIONED?instead
StringDIM_SCREENWhether or not to dim the screen.
StringDTMF_TONE_WHEN_DIALINGWhether the audible DTMF tones are played by the dialer when dialing.
StringEND_BUTTON_BEHAVIORWhat happens when the user presses the end call button if they're not on a call.
StringFONT_SCALEScaling factor for fonts, float.
StringHAPTIC_FEEDBACK_ENABLEDWhether the haptic feedback (long presses, ...) are enabled.
StringHTTP_PROXYThis constant is deprecated. Use?HTTP_PROXY?instead
StringINSTALL_NON_MARKET_APPSThis constant is deprecated. Use?INSTALL_NON_MARKET_APPS?instead
StringLOCATION_PROVIDERS_ALLOWEDThis constant is deprecated. Use?LOCATION_PROVIDERS_ALLOWED?instead
StringLOCK_PATTERN_ENABLEDThis constant is deprecated. Use?LOCK_PATTERN_ENABLED?instead
StringLOCK_PATTERN_TACTILE_FEEDBACK_ENABLEDThis constant is deprecated. Use?LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED?instead
StringLOCK_PATTERN_VISIBLEThis constant is deprecated. Use?LOCK_PATTERN_VISIBLE?instead
StringLOGGING_IDThis constant is deprecated. Use?LOGGING_ID?instead
StringMODE_RINGERRinger mode.
StringMODE_RINGER_STREAMS_AFFECTEDDetermines which streams are affected by ringer mode changes.
StringMUTE_STREAMS_AFFECTEDDetermines which streams are affected by mute.
StringNETWORK_PREFERENCEThis constant is deprecated. Use?NETWORK_PREFERENCE?instead
StringNEXT_ALARM_FORMATTEDA formatted string of the next alarm that is set, or the empty string if there is no alarm set.
StringNOTIFICATION_SOUNDPersistent store for the system-wide default notification sound.
StringPARENTAL_CONTROL_ENABLEDThis constant is deprecated. Use?PARENTAL_CONTROL_ENABLED?instead
StringPARENTAL_CONTROL_LAST_UPDATEThis constant is deprecated. Use?PARENTAL_CONTROL_LAST_UPDATE?instead
StringPARENTAL_CONTROL_REDIRECT_URLThis constant is deprecated. Use?PARENTAL_CONTROL_REDIRECT_URL?instead
StringRADIO_BLUETOOTHConstant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
StringRADIO_CELLConstant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
StringRADIO_WIFIConstant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
StringRINGTONEPersistent store for the system-wide default ringtone URI.
StringSCREEN_BRIGHTNESSThe screen backlight brightness between 0 and 255.
StringSCREEN_BRIGHTNESS_MODEControl whether to enable automatic brightness mode.
intSCREEN_BRIGHTNESS_MODE_AUTOMATICSCREEN_BRIGHTNESS_MODE value for manual mode.
intSCREEN_BRIGHTNESS_MODE_MANUALSCREEN_BRIGHTNESS_MODE value for manual mode.
StringSCREEN_OFF_TIMEOUTThe timeout before the screen turns off.
StringSETTINGS_CLASSNAMEThis constant is deprecated. Use?SETTINGS_CLASSNAME?instead
StringSETUP_WIZARD_HAS_RUNWhether the setup wizard has been run before (on first boot), or if it still needs to be run.
StringSHOW_GTALK_SERVICE_STATUS?
StringSHOW_PROCESSESControl whether the process CPU usage meter should be shown.
StringSHOW_WEB_SUGGESTIONSThis constant is deprecated. Each application that shows web suggestions should have its own setting for this.
StringSOUND_EFFECTS_ENABLEDWhether the sounds effects (key clicks, lid open ...) are enabled.
StringSTAY_ON_WHILE_PLUGGED_INWhether we keep the device on while the device is plugged in.
StringSYS_PROP_SETTING_VERSION?
StringTEXT_AUTO_CAPSSetting to enable Auto Caps in text editors.
StringTEXT_AUTO_PUNCTUATESetting to enable Auto Punctuate in text editors.
StringTEXT_AUTO_REPLACESetting to enable Auto Replace (AutoText) in text editors.
StringTEXT_SHOW_PASSWORDSetting to showing password characters in text editors.
StringTIME_12_24Display times as 12 or 24 hours 12 24
StringTRANSITION_ANIMATION_SCALEScaling factor for activity transition animations.
StringUSB_MASS_STORAGE_ENABLEDThis constant is deprecated. Use?USB_MASS_STORAGE_ENABLED?instead
StringUSER_ROTATIONDefault screen rotation when no other policy applies.
StringUSE_GOOGLE_MAILThis constant is deprecated. Use?USE_GOOGLE_MAIL?instead
StringVIBRATE_ONWhether vibrate is on for different events.
StringVOLUME_ALARMAlarm volume.
StringVOLUME_BLUETOOTH_SCOBluetooth Headset volume.
StringVOLUME_MUSICMusic/media/gaming volume.
StringVOLUME_NOTIFICATIONNotification volume.
StringVOLUME_RINGRinger volume.
StringVOLUME_SYSTEMSystem/notifications volume.
StringVOLUME_VOICEVoice call volume.
StringWAIT_FOR_DEBUGGERIf 1, when launching DEBUG_APP it will wait for the debugger before starting user code.
StringWALLPAPER_ACTIVITYName of activity to use for wallpaper on the home screen.
StringWIFI_MAX_DHCP_RETRY_COUNTThis constant is deprecated. Use?WIFI_MAX_DHCP_RETRY_COUNT?instead
StringWIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MSThis constant is deprecated. UseWIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS?instead
StringWIFI_NETWORKS_AVAILABLE_NOTIFICATION_ONThis constant is deprecated. Use?WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON?instead
StringWIFI_NETWORKS_AVAILABLE_REPEAT_DELAYThis constant is deprecated. Use?WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY?instead
StringWIFI_NUM_OPEN_NETWORKS_KEPTThis constant is deprecated. Use?WIFI_NUM_OPEN_NETWORKS_KEPT?instead
StringWIFI_ONThis constant is deprecated. Use?WIFI_ON?instead
StringWIFI_SLEEP_POLICYThe policy for deciding when Wi-Fi should go to sleep (which will in turn switch to using the mobile data as an Internet connection).
intWIFI_SLEEP_POLICY_DEFAULTValue 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.
intWIFI_SLEEP_POLICY_NEVERValue for?WIFI_SLEEP_POLICY?to never go to sleep.
intWIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGEDValue 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.
StringWIFI_STATIC_DNS1If using static IP, the primary DNS's IP address.
StringWIFI_STATIC_DNS2If using static IP, the secondary DNS's IP address.
StringWIFI_STATIC_GATEWAYIf using static IP, the gateway's IP address.
StringWIFI_STATIC_IPThe static IP address.
StringWIFI_STATIC_NETMASKIf using static IP, the net mask.
StringWIFI_USE_STATIC_IPWhether to use static IP and other static network attributes.
StringWIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGEThis constant is deprecated. UseWIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE?instead
StringWIFI_WATCHDOG_AP_COUNTThis constant is deprecated. Use?WIFI_WATCHDOG_AP_COUNT?instead
StringWIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MSThis constant is deprecated. Use?WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS?instead
StringWIFI_WATCHDOG_BACKGROUND_CHECK_ENABLEDThis constant is deprecated. Use?WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED?instead
StringWIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MSThis constant is deprecated. Use?WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MSinstead
StringWIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNTThis constant is deprecated. Use?WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNTinstead
StringWIFI_WATCHDOG_MAX_AP_CHECKSThis constant is deprecated. Use?WIFI_WATCHDOG_MAX_AP_CHECKS?instead
StringWIFI_WATCHDOG_ONThis constant is deprecated. Use?WIFI_WATCHDOG_ON?instead
StringWIFI_WATCHDOG_PING_COUNTThis constant is deprecated. Use?WIFI_WATCHDOG_PING_COUNT?instead
StringWIFI_WATCHDOG_PING_DELAY_MSThis constant is deprecated. Use?WIFI_WATCHDOG_PING_DELAY_MS?instead
StringWIFI_WATCHDOG_PING_TIMEOUT_MSThis constant is deprecated. Use?WIFI_WATCHDOG_PING_TIMEOUT_MS?instead
StringWINDOW_ANIMATION_SCALEScaling factor for normal window animations.
  相关解决方案