I've tried the recommended
setSpeakerphoneOn(true)
and the unrecommended
AudioSystem.setForceUse(AudioSystem.FOR_MEDIA, AudioSystem.FORCE_SPEAKER);
but neither has worked.
I've tried
setWiredHeadsetOn(false)
but that doesn't work either, and is deprecated.
Interestingly,
isSpeakerphoneOn()
reports true, as does
isWiredHeadsetOn()
Additionally, the following permission is set
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
Use an audio splitter or Bluetooth adapter A splitter offers a plug-and-play solution. Simply plug the splitter into your PC and plug the headphones into one port and the speakers into another. It's best to buy a high-quality audio splitter. Cheap splitters can negatively affect the quality and volume of your sound.
Look for the sound icon on the bottom-right corner of your PC's screen. Right-click on it and select 'Sounds'. Click on the 'Playback' tab and select your headphones from the list of devices. Right-click on it and tap on 'Set as default device'.
Make yourself a little box, with a stereo input jack socket (or TRRS socket if required) and wire two stereo output jack sockets in parallel with this. Plug in a suitable cable between the box and your audio source, and plug headphones and/or speakers into the output sockets.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With