I have find the solution, hope it can help others
AudioManager audio_service = (AudioManager) getSystemService
(Context.AUDIO_SERVICE);
// set the mode in call, so that the sound can come from
earpiece
audio_service.setSpeakerphoneOn(false);
audio_service.setMode(AudioManager.MODE_IN_CALL);
audio_service.setRouting(AudioManager.MODE_NORMAL,
AudioManager.ROUTE_EARPIECE,
AudioManager.ROUTE_ALL);
On Oct 19, 11:25 pm, feeling3_4 <[email protected]> wrote:
> Hi, all
> In my app, I use the MediaPlayer, the sound comes from the speaker.
> I just want to know how to play the music in the earpiece.
>
> The dev guide says that "You can play back the audio data only to
> the standard output device; currently, that is the mobile device
> speaker or Bluetooth headset. You cannot play sound files in the
> conversation audio.". But actually I have seen some apps that can play
> sound in the channel which conversation audio comes from.
>
> Did I miss anything? Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---