android settings has three types of attributes, namely global, system and secure, corresponding to the three tables of /data/data/com.android.providers.settings/databases/settings.db 1) global:all preferences are open to all users of the system, and the third-party app has read permission,no write permission 2) system:contains a variety of user preferences system settings 3) secure:user preference system setting for security,and the third-party app has read permission,no write permission
android settings usage
1) settings list This command is used to view the values of three properties, such as View all global values
2) settings get Settings get is used to get the value of a single key in global, system and secure, such as auto_time in global
1 2 3
console:/ $ settings get global auto_time 0 console:/ $
3) settings put
settings put is used to set the value of a single key in global, system and secure, such as auto_time in global
1 2 3 4
console:/ $ settings put global auto_time 1 console:/ $ settings get global auto_time 1 console:/ $
for the key in system,secure,the command is similar
1 2 3 4 5 6 7 8 9
console:/ $ console:/ $ settings get system accelerometer_rotation 0 console:/ $ settings put system accelerometer_rotation 1 console:/ $ console:/ $ console:/ $ settings get system accelerometer_rotation 1 console:/ $
Settings can get and set many system variables, such as getting and modifying wifi status (wifi_on),airplane mode(airlpane_mode_on), system prompt tone (notification_sound), etc