Routing Audio data to Both HEADSET and SPEAKER.

by Anand » Thu, 22 Apr 2010 19:43:18 GMT

Sponsored Links

As particular need, I want to route the Audio data to both HEADSET and
SPEAKER. For example if I play a Music file, I want that the output
should come on speaker and on headset as well. My first question is
weather is it possible or not in the current clair SDK.

As per my understanding, the Headset plugging/unplugging is detected
by the kernel switch driver and the event is sent to Then broadcasts the intent
Intent.ACTION_HEADSET_PLUG with information about state as plugged/
unplugged. This intent is received by and the
audiomanager/audioFlinger is informed to turn on/off the speaker. The
audioManager/AudioFlinger further passes the information to (AudioHardware.cpp). Then in the end the information is
passed to kernel to switch between the speakerphone and Headset.

I have found a case in AudioHardware.cpp as

That being said, please tells me how I can enable both the Headset and
Speakerphone. Incase required, I can furnish more investigation, what
I have done so far.



Other Threads

1. Choosing an Image

Hi Everyone,

I'm trying to allow the user to choose an image to load into my app
using the default image browser on the phone.
Here is what I have so far:

Intent findImageIntent = new Intent(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(findImageIntent, "Select
Picture"), IMAGE_SELECT);

This correctly launches the image chooser and I'm able to click one
which returns me to my main activity.  However, it does not load the
image I selected, returning a -1 for resultCode in onActivityResult.

Anyone know what I'm doing wrong?


2. Change application preferences programmaticaly

First, there is no single "defalut SMS application". Each device may
have different ones.

Second, the AOSP Messaging application ( is not part
of the Android SDK, and so there are no documented APIs for
manipulating it.

You cannot modify settings in another application, any more than other
applications can hack into yours. Sorry!

Mark Murphy (a Commons Guy) | |

_Android Programming Tutorials_ Version 2.9 Available!


3. OOT : Konsultasi GRATIS dengan dokter via Instant Messaging, 24 jam sehari, 7 hari seminggu tanpa batas

4. J2ME

5. Change application preferences programmaticaly

6. How to register a long click on a WebView somewhere else than on links?

7. geoCoder: getFromLocationName ?