Can't set microphone mute - Android -
i'm trying mute microphone in android application
audiomanager = (audiomanager)getsystemservice(context.audio_service); audiomanager.setmicrophonemute(true);
i added permission in manifest
<uses-permission android:name="android.permission.modify_audio_settings" />
however, when speak application, logs return me said means microphone not muted.
even logs tell me mic should muted. :
log.d("muted ? : ", string.valueof(audiomanager.ismicrophonemute()));
display log :
muted ? : true
i don't know problem. have idea ?
i tried same, thought problem in devices, devices can mute microphone, tried same solution of answer:
setmicrophonemute(boolean) doesn't work on devices
i simulate press on mute button on handsfree kit . worked me hope here 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");
Comments
Post a Comment