Forcing sound output through speaker in Android
You can change this system-wide using the AudioManager.setSpeakerphoneOn
method.
I don't believe you can set this for a particular MediaPlayer
/AudioTrack
/SoundPool
instance, but depending on your use case, you might actually be looking to set your audio stream type using MediaPlayer.setAudioStreamType
or an equivalent for other audio playback classes.