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

The answer turned out to be the following, with tips from
Android – Getting audio to play through earpiece

audioManager.setMode(AudioManager.MODE_IN_CALL);
audioManager.setSpeakerphoneOn(true);

Ignore setRouting, it does nothing in APK > 10. Ignore comments about setMode. Ignore comments about setWiredHeadsetOn. Make sure you have MODIFY_AUDIO permissions.

Leave a Comment