Android怎么判断设备是否静音
PHPz
PHPz 2017-04-17 11:04:02
0
1
1034

我在开发一款应用,需要播放声音和用户交互,但是很多时候用户的手机是静音状态的。
Android有没有接口,可以判断他现在是不是处在静音状态,然后我可以弹出一个提示
他点击一个按钮,就把声音开启

PHPz
PHPz

学习是最好的投资!

reply all(1)
PHPzhong

Mute means the volume is 0. Use AudioManager to get the current volume and determine whether it is 0.

But there are many types of volume in the Android system: STREAM_VOICE_CALL, STREAM_SYSTEM, STREAM_RING, STREAM_MUSIC, STREAM_ALARM

I think all you need is to check the media volume STREAM_MUSIC

Official documentation: http://developer.android.com/referenc...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template