Is there a way in Android to force output through the phone speaker, even if a headphone is plugged into the jack? I know there has to be a way because when you are talking on the phone, you can put someone on speaker phone, even if there is headphones plugged into the jack.
Share
You can change this system-wide using the
AudioManager.setSpeakerphoneOnmethod.I don’t believe you can set this for a particular
MediaPlayer/AudioTrack/SoundPoolinstance, but depending on your use case, you might actually be looking to set your audio stream type usingMediaPlayer.setAudioStreamTypeor an equivalent for other audio playback classes.