0

I want to play a notification tone when an event happended while the headset is plugged in

The following approaches does not work on my Samsung pocket device which has Android 4.0.4

how to turn speaker on/off programatically in android 4.0

Is there any way to force audio through the speakers when headphones are plugged in?

My device has an FM radio and that app has the feature of turning the sound to the loud speaker. Something like this would be helpful. Any notification sound would be find. I think it should be there a different implementation.

Community
  • 1
  • 1
yasserbn
  • 391
  • 3
  • 18
  • Did you try registering a `BroadcastReceiver` (with `IntentFilter` `ACTION_HEADSET_PLUG`) and playing a sound through either `MediaPlayer` or `SoundPool` upon receiving `ACTION_HEADSET_PLUG` event? – Gagan Jun 26 '14 at 13:12
  • The event is not Headset plugging, it is a different thing, but it happens while the headset is plugging in – yasserbn Jun 26 '14 at 13:17
  • Which stream type are you using? – Michael Jun 26 '14 at 14:29
  • I tried Stream_music, stream_call and stream_system, with no luck – yasserbn Jun 27 '14 at 07:17

0 Answers0