简体   繁体   中英

adb command to set volume of android 11 device

I want to set volume of Android 11 device via adb command to 5.Does anyone know such commands?

Below command works well for Android 8,9,10 but fails to work for Android 11.

adb -s <deviceId> shell media volume --show --stream 3 --set 5

The code for setStreamVolume in android 11 is 10 . So, you can set the volume using below command -

adb shell service call audio 10 i32 3 i32 <required volume>

Example:

adb shell service call audio 10 i32 3 i32 15

For me, 0 is min volume and 15 is max volume.

I don't sure struct of "media volume" via command. But in android 11, you can using below command:

  adb shell service call audio 10 i32 'x' i32 0 i32 1

Ex: adb shell service call audio 10 i32 3 i32 0 i32 1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM