Adb to open settings and change them

I am looking for an adb command to open the settings and change them. For example: this command opens display settings

adb shell am start -n com.android.settings/.DisplaySettings 

I want to go further in the menu to display the output mode, then select 720P 60HZ

Like my menu like this on Android TV Box:

Settings> Display> Display output mode> HDMI 720P60HZ, etc.

Is there an adb command for this, go to settings and select 720P60Hz directly using the shell?

+5
source share
2 answers

As far as I know, this is not such functionality. However you can use

 adb shell input tap <x> <y> 

to trigger a touch event. Unfortunately, such a code will not work autonomously, since the position of your settings on the screen depends on the device you are using.

Alternatively you can try

 adb shell input keyevent <19|20|21|22> 

to emulate cursor events, to select the parameter you want to change.

Finally you can use

 adb shell input keyevent 66 

to call the enter key. This should work on all devices that have the same settings in the settings submenu.

+2
source

Use this command to see help on how you can use the settings adb shell command:

 adb shell settings 

Use the get and put commands (after settings ) to change the settings.

You will need to independently determine the KEYS ( list uses) and acceptable VALUES (read the documentation such as https://developer.android.com/reference/android/provider/Settings.Global for the global NAMESPACE).

0
source

All Articles