Reputation: 96
I've been searching through the questions but can't find a similar one.
I'm trying to set the volume of the phone while on a call from my program. I'm using Java and Eclipse. I want this to run on ICS.
The ultimate goal is to make an app that lets the user select a contact (or group of contacts) and assign a specific volume to the phone when this person calls. Not the ringer, but the incall volume.
For example, my mother-in-law barks over the phone (in person too!) and every time she calls I have to press the volume down several times. Then, another person calls and I can barely hear them.
I have searched the play store for a similar app with no luck.
Upvotes: 7
Views: 9411
Reputation: 6479
Try this
AudioManager audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
audioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL, 20, 0);
In case this doesn't work for some reason (didn't try it) you might want to read these
http://developer.android.com/reference/android/app/Activity.html#setVolumeControlStream(int) http://developer.android.com/reference/android/media/AudioManager.html#STREAM_VOICE_CALL
Upvotes: 6