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

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -