Android Question Definitely SOLVED : Send audio to headphone or to internal speaker

coslad

Well-Known Member
Licensed User
Longtime User
Hi

i want to use this gadget with my b4a app :



when i insert it into the headphone jack hole , the phone recognizes it as a headphone and the audio is directed to it , but , if i before install the "pressy" app , when i put the jack inside the hole, the system asks me if i want to use the phone as normal or if i want to send the audio to the headphone , and if i reply yes , the audio is sent to the internal speaker and mic , even thought the jack is inserted into the hole .

So , knows somebody the code to do that ?
 

coslad

Well-Known Member
Licensed User
Longtime User
Solved :

from android 6 the method has 4 menbers so you must write this :

B4X:
r.RunMethod4("setWiredDeviceConnectionState", Array (4, 0, "","device"), ArrayAsString("java.lang.int", "java.lang.int", "java.lang.String", "java.lang.String"))

before android 6 instead :


B4X:
r.RunMethod4("setWiredDeviceConnectionState", Array (4, 0,"device"), ArrayAsString("java.lang.int", "java.lang.int", "java.lang.String"))


Sembra facile.... (seems easy..)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…