SetVolumeControlStream not working on ICS

I have an application that manages phone calls, and I need to control the volume of the call when the speaker is turned on during a call, and the volume of the ringtone when an incoming call arrives.

I use:

setVolumeControlStream( AudioManager.STREAM_MUSIC ); 

my Activity onCreate () to control the flow using hard volume keys. So far, I can control the volume with the speaker turned on. Moreover, this only works fine on GingerBread devices, but it does not affect ICS devices.

Is there any known incompatibility? How can I control the ringtone level? I also tried:

 setVolumeControlStream( AudioManager.STREAM_RING ); 

but again does not affect both types of devices.

By the way, I noticed that pressing hard keys when the phone is ringing changes the “volume of multimedia applications” and not the “ringtone volume” (??).

Thanks in advance.

+4
source share

Source: https://habr.com/ru/post/1413913/


All Articles