Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set in-call volume programmatically on android?

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.

like image 521
Adan Vasconcelos Avatar asked Oct 11 '12 04:10

Adan Vasconcelos


People also ask

How do I get incoming call volume?

Open Settings , enter Sounds & vibration; Drag the slider under Ringtone and Calls to the right to turn up their volumes.

Is there an app to increase call volume on Android?

Volume Booster is a free volume booster app for Android that increases your headphones or speaker volume as you play music, audiobooks or watch a movie on your device.

What is media volume on Android?

The in-call volume refers to the volume of voice and video calls, while the media volume refers to the volume at which background music, videos, and audio effects are played.


1 Answers

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

like image 192
Gubatron Avatar answered Oct 11 '22 13:10

Gubatron