Well, this code is kinda correct - although you shouldn't be using
'am' for the static values, instead you should be using the
AudioManager object directly - your compiler is probably complaining
about that.

In a more perfect world your code would be a little more like...

/************************/
private AudioManager am;
am = (AudioManager)activity.getSystemService
(android.content.Context.AUDIO_SERVICE);
am.setRouting(AudioManager.MODE_NORMAL, AudioManager.ROUTE_EARPIECE,
AudioManager.ROUTE_ALL);
/************************/

However, that does not seem to be your problem... that's just me being
picky :)

What kind of device are you trying this on?  I ask, because I have
some code that does EXACTLY the same and although it seems to be
working just fine on the G1, there have been problems reported with
the myTouch just ignoring requests like this.

Doug


On Aug 20, 1:16 pm, CR <[email protected]> wrote:
> I forgot to include a line, and although it's kind of obvious, I want
> to be complete:
>
> /************************/
> private AudioManager am;
> am = (AudioManager)activity.getSystemService
> (android.content.Context.AUDIO_SERVICE);
> am.setRouting(am.MODE_NORMAL, am.ROUTE_EARPIECE, am.ROUTE_ALL);
> /************************/
>
> On Aug 20, 4:10 pm, CR <[email protected]> wrote:
>
>
>
> > Hi all. I'm trying to change theaudiopathtoearpiecefrom
> >speakerphone, and I cannot get it to work on the G1: theaudioalways
> > goes through thespeakerphone. Here's the code snippet:
>
> > /************************/
> > private AudioManager am;
> > am.setRouting(am.MODE_NORMAL, am.ROUTE_EARPIECE, am.ROUTE_ALL);
> > /************************/
>
> > I took logs for this issue and compared them to logs from the calling
> > app when I turn off thespeakerphonethere and they look similar:
>
> > (from calling app)
> > D/AudioFlinger(   35): setRouting 2 1 -1, tid 57, calling tid 58
> > E/AudioFlinger(   35): mA2dpDisableCount is already zero
> > I/AudioHardwareMSM72XX(   35): Routingaudioto Handset
> > D/HTC Acoustic(   35): msm72xx_enable_audpp: 0x0000
>
> > (from my app)
> > D/AudioFlinger(   35): setRouting 0 1 -1, tid 54, calling tid 58
> > I/AudioHardwareMSM72XX(   35): Routingaudioto Handset
> > D/HTC Acoustic(   35): msm72xx_enable_audpp: 0x0000
>
> > The main difference here is that I'm trying to change theaudiopath
> > for MODE_NORMAL, while the calling app ischangingtheaudiopathfor
> > MODE_IN_CALL. Any suggestions or observations are helpful. Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to