简体   繁体   English

adb 命令设置 android 11 设备的音量

[英]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?我想通过 adb 命令将 Android 11 设备的音量设置为 5。有人知道这样的命令吗?

Below command works well for Android 8,9,10 but fails to work for Android 11.以下命令适用于 Android 8,9,10,但不适用于 Android 11。

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

The code for setStreamVolume in android 11 is 10 . android 11 中setStreamVolume的代码为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.对我来说, 0是最小音量, 15是最大音量。

I don't sure struct of "media volume" via command.我不确定通过命令的“媒体卷”结构。 But in android 11, you can using below command:但在 android 11 中,您可以使用以下命令:

  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例如:adb shell 服务呼叫音频 10 i32 3 i32 0 i32 1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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