0

Which API calls do I have to make to get the hardware volume control buttons to control the speaker volume when in speakerphone mode ??

I have tried to call setVolumeControlStream(AudioManager.STREAM_MUSIC)

but that doesn't help. The HW vol buttons only adjusts the speaker volume in handset mode. As soon as I switch to speakerphone mode, the HW buttons don't control the speaker volume anymore.

This is how I switch to speakerphone mode:

thisAudioMgr.setMode(AudioManager.MODE_IN_COMMUNICATION);
thisAudioMgr.setSpeakerphoneOn(true);
user1884325
  • 2,530
  • 1
  • 30
  • 49
  • why do you need to switch to speakerphone explicitly as detaching earpiece will automatically route the audio output to speaker phone...you just need to check which device is used for output currently using methods `isSpeakerphoneOn()`,`isWiredHeadsetOn()` and write particular code in this cases.... – Yogesh D Mar 13 '14 at 09:31
  • I should probably say 'handset mode' instead of 'earpiece mode'. Nothing is plugged into the phone's audio output. – user1884325 Mar 13 '14 at 14:52
  • From the `setVolumeControlStream` documentation: _"It is not guaranteed that the hardware volume controls will always change this stream's volume (for example, if a call is in progress, its stream's volume may be changed instead)"_. By changing the mode to `MODE_IN_COMMUNICATION` you're probably causing the audio framework (specifically, the `AudioService`) to select `STREAM_VOICE_CALL` as the stream to change the volume for, rather than the stream you specified (`STREAM_MUSIC`). – Michael Mar 13 '14 at 15:22
  • @user1884325 check if in your case when you switch from headset mode to speakerphone mode sound stream is getting muted. If so then try to unmute it. – Yogesh D Mar 14 '14 at 06:29

0 Answers0