1

When there is a phone call and if im using my earphones,i want the sound of the ringtone to go through the earphones. In this app setSpeakerphoneon() is not working, any other ideas to stream the ringing through earphones when a call comes?

P.S:im using sdk 2.3.3

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

0

Every single Android implementation I've seen routes ringtones to Speaker + wired headset/headphones if you've got a wired accessory attached. If you want the ringtone to be played only in the wired accessory you should be able to accomplish that with AudioManager.setRingerMode() (using RINGER_MODE_VIBRATE or RINGER_MODE_SILENT).
This might be undesirable for the user though, especially if there's no wired accessory attached or the user doesn't have the earplugs in his/her ears.

Michael
  • 57,169
  • 9
  • 80
  • 125
  • Doesn't work.when my ear phones are plugged,the ringing tone doesn't come through the earphones.....only through the speakers...what are the alternatives to the deprecated routing code? – android_begginer94 Aug 20 '12 at 18:02
  • You should definitely not be getting the ringtone in the loudspeaker if you've set the ringer mode to VIBRATE or SILENT, unless some app on your phone is automatically changing it back for you. If you set it after the ringtone has started then the behavior might differ between different implementations, but if you set it before the ringtone starts it should certainly works. Did you get any kind of error messages in logcat when setting the ringer mode? – Michael Aug 20 '12 at 18:32
  • if(RECIEVED PHONE CALL&& EARPHONES PLUGGED IN){ // Divert ringing to earphones not speakers } – android_begginer94 Aug 21 '12 at 04:45
  • What I need is something like this – android_begginer94 Aug 21 '12 at 04:49
  • In silent mode the speakers are mute.But there is a beeping tone through the earphones.I want the ringing itself to be routed through the earphones....I know that there is this mAudioManager.setMode(AudioManager.ROUTE_EARPIECE) //which is deprecated....any alternatives to exactly replace that.. – android_begginer94 Aug 21 '12 at 05:01
  • Other than the ringer mode there's nothing that I'm aware of that will accomplish this. The rationale being that as a user you'll want to know if someone is calling you, even if you left your phone on the table or in your pocket with a pair of headphones attached. That's why the ringtone always goes to the speaker, unless the ringer mode is SILENT/VIBRATE. – Michael Aug 21 '12 at 05:23
  • The Android app, [SoundAbout](https://play.google.com/store/apps/details?id=com.woodslink.android.wiredheadphoneroutingfix) can do this. – WoodsLink Aug 16 '16 at 14:33