微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – ADB命令设置音量?

是否有任何Adb命令将音量设置为特定值?我知道我们可以做到

adb shell input keyevent 

音量增大和减小但我想将其设置为特定值.如果我更改它,那么我必须重启设备才能反映更改,所以我不想走那条路.是否有任何API我可以更改值而无需重新启动它并且必须依赖于音量调高和调低?

解决方法:

也可以使用media shell命令:

media volume:  the options are as follows: 
    --stream STREAM selects the stream to control, see AudioManager.STREAM_*
                    controls AudioManager.STREAM_MUSIC if no stream is specified
    --set INDEX     sets the volume index value
    --adj DIRECTION adjusts the volume, use raise|same|lower for the direction
    --get           outputs the current volume
    --show          shows the UI during the volume change
examples:
    adb shell media volume --show --stream 3 --set 11
    adb shell media volume --stream 0 --adj lower
    adb shell media volume --stream 3 --get

一个例子可能是你正在寻找的那个(但在询问时它可能不存在)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐