3

Can you please tell me how can I route audio to bluetooth ear when a bluetooth ear piece is paired?

I have set my audio manager to be MODE_IN_CALL.

audioManager.setMode(AudioManager.MODE_IN_CALL);

I read Android - Getting audio to play through earpiece, but I am not sure if that apply to my case, since it refers to some deprecated methods. Plus, doesn't android detects if there bluetooth ear piece is paired and routed to ear piece on phone or bluetooth ear piece automatically?

Thank you.

Community
  • 1
  • 1
michael
  • 106,540
  • 116
  • 246
  • 346

1 Answers1

0

you can only send audio to the headset if the headset is a bluetooth headset compatible with the a2dp profile. if that is the case, then just playing audio through the media stream gets the job done.

hmm, i would also add, that if you are currently in a call, and you play audio through the voice stream, then any headset (a2dp or otherwise) can hear the audio. Unfortunately, you need to be in a call. I have found that setting the mode to MODE_IN_CALL does nothing.

ekawas
  • 6,594
  • 3
  • 27
  • 39
  • I have a bluetooth earpiece, which when I paired with the android phone, and call my android phone, I can hear the phone call via the bluetooh earpiece. So is my headset compatible with the a2dp profile? – michael Oct 13 '10 at 20:46
  • you can usually tell if you can hear music from the default media player with your headset. Also, I think that your phone will say paired to media and phone audio. – ekawas Oct 13 '10 at 21:17
  • I have called 'mPlayer.setAudioStreamType(AudioManager.STREAM_VOICE_CALL);' but it still does not play via the bluetooth ear piece. – michael Oct 13 '10 at 23:43
  • 1
    If all that you are trying to do is play music (when not in a call), then use the STREAM_MUSIC ... if the headset is A2DP compatible, then it will hear the music. Also, take a look at AudioManager.isBluetoothA2dpOn(), to make sure that the system thinks that your headeset is plugged in. – ekawas Oct 14 '10 at 13:27