audioManager.getstreamVolume(AudioManager.STREAM_R

2019-08-10 21:52发布

问题:

I am trying to get the ring volume, but it always gives 0, regardless of what volume I have set it to (I do this by accessing it via Settings on the phone).

audioManager.getstreamVolume(AudioManager.STREAM_RING) 

The same API works properly with the other audio streams AudioManager.STREAM_NOTIFICATION, AudioManager.STREAM_MUSIC, etc. Could anyone let me know why this is happening and how I can correct it?

回答1:

Your code is correct. The call returns 0 when your phone is in mute or vibration mode. Checkout your ringer mode.

audioManager.setRingerMode(ringerMode);