Android Question Enable internal speaker with headphones plugged

Marcob

Member
Licensed User
Longtime User
The speaker is usually disconnected at the hardware level by a contact within the headphones jack. It does not seem possible to do anything by code.

I was thinking the same but then I used the FM radio app where you can enable the speaker also with the headphones plugged...
 
Upvote 0

MitchBu

Well-Known Member
Licensed User
Longtime User
I was thinking the same but then I used the FM radio app where you can enable the speaker also with the headphones plugged...

You are right. It works even through the headphones are plugged. It means there is a software access.

All channels seem trapped by the headphones : Music, voice, system.

But I just verified : the phone rings with headphones plugged in. Meaning the ring channel is available. Problem is, there seems to be no simple access to the ring channel, the only example I found was through the Media Player which would not work for your use.

There seems to be a Java method to ring (second post at http://stackoverflow.com/questions/2618182/how-to-play-ringtone-alarm-sound-in-android ) . Maybe a Java library can do that but I do not know how to package one.

Maybe you can have a look here : http://www.b4x.com/android/forum/th...uild-libraries-without-eclipse.29918/#content
 
Upvote 0

lemonisdead

Well-Known Member
Licensed User
Longtime User
Hi,
Erel did something like that using Reflection. Perhaps could you check this code ? I didn't do the test
 
Upvote 0

Marcob

Member
Licensed User
Longtime User
Hi,
Erel did something like that using Reflection. Perhaps could you check this code ? I didn't do the test

I tested that code on 3 phones:

1) LG P500 (android 2.3.3)
2) SG S (android 4.2.2)
3) Zopo C2 (android 4.2.1)

With phone 1) the code works and is able to enable the speaker while the headphones are plugged using r.RunMethod2("setMode", 1, "java.lang.int").
Unfortunately the code doesn't work with the other two phones (but the FM radio app still does). I think that there should be some other way, hopefully more device independent, to enable the speaker or perhaps it is just the radio output that could be easily routed to it...
 
Upvote 0
Top