I want to mute my microphone programmatically ,i tried the following code but it is use full.
micro_phone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AudioManager audioManager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
audioManager.setMode(AudioManager.MODE_IN_CALL);
if (audioManager.isMicrophoneMute() == false) {
audioManager.setMicrophoneMute(true);
} else {
audioManager.setMicrophoneMute(false);
}
Check if you added permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" , it is mandatory for changing audio settings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With