audio - How to choose sound device in android -


i connected usb handsfree android device. need switch sound input between handfree , built-in microphone. in devices (like mk802 hdmi-tv-console) threre system menu sound input , output changed.

i searching way change input , ouput console or code.

i'm not aware of official way of doing want. rationale being like: if didn't want use handsfree wouldn't have plugged in in first place.

there few things try, they're not guaranteed work across devices , android versions.
for playback try audio routed loudspeaker instead of usb accessory:

class audiosystemclass = class.forname("android.media.audiosystem"); method setforceuse = audiosystemclass.getmethod("setforceuse", int.class, int.class); // first 1 == for_media, second 1 == force_speaker. go default // behavior, use force_none (0). setforceuse.invoke(null, 1, 1); 

and recording try using voice_call or camcorder audiosource instead of mic or default.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -