title: Programmatically muting a call in Android
body: <p>I am revisiting an old question posted (in early 2014 mind) here: </p>
  
  <ul>
  <li><p><a href="https://stackoverflow.com/questions/21468064/what-permissions-are-needed-to-programmatically-mute-a-phone-call-from-a-backgr">What permissions are needed to programmatically mute a phone call, from a background app?</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/10521394/how-to-mute-phone-call-stream-uplink-while-calling-on-android">How to Mute Phone Call Stream (uplink) while calling on Android</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/7884526/how-to-mute-audio-speaker-in-android">How to mute audio speaker in android</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/6874881/how-does-setmicrophonemute-work">How does setMicrophoneMute() work?</a></p></li>
  </ul>
  
  <p>For a recent project, I am building an app that can mute an existing call and get an audio recording from the user. I know that audio-recording in-call works, that's no problem (recording only the user mic). Now i can also reduce the volume programmatically, which i did using the code <a href="https://github.com/commonsguy/cw-advandroid/blob/master/SystemServices/Volume/src/com/commonsware/android/syssvc/volume/Volumizer.java" rel="nofollow noreferrer">On my Github, Here</a> </p>
  
  <p>Specifically, I am using the <a href="https://developer.android.com/reference/android/media/AudioManager.html#adjustStreamVolume(int,%20int,%20int)" rel="nofollow noreferrer">AudioManager</a> class to set the volume to 0 and also muting as a backup, but doesn't work.. I am wondering whether this is a Samsung specific issue or not.. </p>
  
  <pre><code>mgr.setStreamVolume(stream, progress, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE);
  mgr.adjustVolume(AudioManager.ADJUST_MUTE, AudioManager.FLAG_VIBRATE);
  boolean a = mgr.isVolumeFixed();
  Log.d("MUTING", "Volume fixed: "+a);
  boolean streamMuteStatus = mgr.isStreamMute(stream);
  Log.d("MUTING", "Stream Mute Status: "+streamMuteStatus);
  </code></pre>
  
  <p>I am printing out the boolean variables above for testing purposes, but both print out 'False'.</p>
  
  <p>But the Samsung S5 device is not allowing me to set the volume to 0 at all. This is true even when adjusting the in-call volume using the volume slider.. The slider does not physically move to the leftmost position on the seekbar. See figure below for the leftmost position i can drag to: </p>
  
  <p><a href="https://i.stack.imgur.com/rD00dm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rD00dm.png" alt="The minimum position of the call volume seekbar"></a></p>
  
  <p>Anyone have any ideas about how i can mute the incoming call stream? </p>