I couldn't find any related post here (but other small posts on the internet), so here it is:
AudioManager.setMicrophoneMute(boolean) doesn't do anything on some particular devices that I tested with: Google Nexus S, Samsung Galaxy S and Motorola Milestone. On any other device it works well.
It even maintains its "state" and returns a boolean as if it got muted\unmuted, but it doesn't mute - microphone continues to record - both in GSM call and in AudioRecord programmatic recording. There is no indicative log message.
I also messed with permissions (android.permission.MODIFY_AUDIO_SETTINGS, android.permission.RECORD_AUDIO), nothing new here.
Did anyone else encounter that? Does anyone have a workaround or a magic solution? If I use AudioRecord I just implement my own "mute" for these devices - I don't pass on the recorded buffers. But it can't help me with muting the mic in a GSM call, which I need.
Thanks
---------------- Update ----------------
See below.
Hi i had the same problem i wanted to simulate incoming call screen. and within that screen a button that perform mute, and the AudioManager.setMicrophoneMute(boolean) worked on most phones but not on all of them. i found a way to get around it. i simulate a press on mute button on the handsfree kit . it worked for me hope it will help you too here is the code:
Intent buttonUp = new Intent(Intent.ACTION_MEDIA_BUTTON);
buttonUp.putExtra(Intent.EXTRA_KEY_EVENT,new KeyEvent(KeyEvent.ACTION_UP,KeyEvent.KEYCODE_HEADSETHOOK));
getBaseContext().sendOrderedBroadcast(buttonUp,"android.permission.CALL_PRIVILEGED");
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