Forum Xamarin.Android

Routing audio to speaker when headphone is plugged in

I am trying to have sound played through the device speaker when a headphone device is plugged in (in this case, a magstripe reader). However, nothing I have tried seems to work. At a basic level I thought this would work:

MediaPlayer player = MediaPlayer.Create(this, mySound);
player.SetAudioStreamType(Stream.Alarm);     
player.Start();

And have also tried to adapt this and this with no luck.

Has anyone had any success with this?

Sign In or Register to comment.