How to use the command "adb shell settings" (with examples)
- Android
- December 25, 2023
The adb shell settings
command allows users to get, set, and delete specific settings in the Android OS. It provides a way to interact with various system settings and configurations.
Use case 1: Display a list of settings in the global
namespace
Code:
adb shell settings list global
Motivation: When troubleshooting or configuring the Android OS, it can be helpful to see a list of available settings. By using this command, users can quickly view all the settings in the global
namespace.
Explanation:
adb shell settings
is the command to interact with Android OS settings.list global
specifies that we want to display a list of settings in theglobal
namespace.
Example output:
adb shell settings list global
bluetooth_on
data_roaming
http_proxy
...
Use case 2: Get a value of a specific setting
Code:
adb shell settings get global airplane_mode_on
Motivation: Users might need to check the current value of a specific setting to understand its current state. This command allows users to retrieve the value of the airplane_mode_on
setting.
Explanation:
adb shell settings
is the command to interact with Android OS settings.get global airplane_mode_on
is used to get the value of theairplane_mode_on
setting in theglobal
namespace.
Example output:
adb shell settings get global airplane_mode_on
0
In this example, 0
represents that the airplane_mode_on
setting is currently set to off.
Use case 3: Set a specific value of a setting
Code:
adb shell settings put system screen_brightness 42
Motivation: Users might want to customize their device’s settings according to their preferences. This command allows users to set the screen brightness to a specific value.
Explanation:
adb shell settings
is the command to interact with Android OS settings.put system screen_brightness 42
sets thescreen_brightness
setting in thesystem
namespace to42
.
Example output:
adb shell settings put system screen_brightness 42
There is no output when setting a specific value of a setting. However, the setting will be applied to the device.
Use case 4: Delete a specific setting
Code:
adb shell settings delete secure screensaver_enabled
Motivation: Users might want to remove a specific setting that is no longer required or causing conflicts. This command allows users to delete the screensaver_enabled
setting from the secure
namespace.
Explanation:
adb shell settings
is the command to interact with Android OS settings.delete secure screensaver_enabled
removes thescreensaver_enabled
setting from thesecure
namespace.
Example output:
adb shell settings delete secure screensaver_enabled
There is no output when deleting a specific setting. However, the setting will be removed from the device.
Conclusion:
The adb shell settings
command provides a versatile way to manage and interact with settings in the Android OS. By using various arguments, users can view, get, set, and delete specific settings based on their requirements, allowing them to customize and troubleshoot their devices more effectively.