0

I noticed that under Android 4.x setting ring volume to 0 is not possible. If I execute this code and then I go to Settings--> Sound --> Volumes I can see it is set to 1. I

audiomanager.setStreamVolume(AudioManager.STREAM_RING, 0, 0);

Do you know why? I know I could use audiomanager.setRingerMode(RINGER_MODE_SILENT) but annoys me!! because in this case I would have to "remember" if vibration is on or off for activating again sound.

Of course, all this works in other Android versions.

4

2 回答 2

1

不要使用setStreamMute(),因为它对您的流程的生命周期有奇怪的副作用。请参阅文档:

静音命令可防止客户端进程死亡:如果在流上具有活动静音请求的进程死亡,则该流将自动取消静音。

恐怕带有RINGER_SILENTRINGER_VIBRATE的setRingerMode()是要走 的路,这将产生将流音量归零的效果

于 2013-08-16T17:30:42.593 回答
0

尝试setStreamMute代替,这相当于将音量设置为 0。

于 2012-07-01T17:06:05.323 回答