android - Microphone and audio not working on Bluetooth devices on VoIP calls -


i have app communicates through voip users. working fine except when connect bluetooth device device. how can manage audiostream , microphone change bluetooth device when there 1 connected? here code:

private int savedaudiomode = audiomanager.mode_in_communication;  audiomanager = (audiomanager) getactivity().getsystemservice(context.audio_service);  getactivity().setvolumecontrolstream(audiomanager.stream_voice_call); 

and is method change focus norma speaker.

private void setaudiofocus(boolean setfocus) {         if (audiomanager != null) {             if (setfocus) {                 savedaudiomode = audiomanager.getmode();                 // request audio focus before making device switch.                 audiomanager.requestaudiofocus(null, audiomanager.stream_voice_call,                         audiomanager.audiofocus_gain);                  /*                  * start setting mode_in_communication default audio mode.                  * required in mode when playout and/or recording starts                  * best possible voip performance. devices have difficulties speaker mode                  * if not set.                  */                  audiomanager.setmode(audiomanager.mode_in_communication);             } else {                 audiomanager.setmode(savedaudiomode);                 audiomanager.abandonaudiofocus(null);             }         }     } 

any appreciated, thanks.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -