I need to have some custom behavior in my app when the audio playback is done on the device speaker (not a wired headphone and not a BlueTooth receiver). To do so I'm doing the following
AudioManager audioManager = (AudioManager) service.getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
isSpeakerPhoneOn = audioManager.isSpeakerphoneOn();
But isSpeakerPhoneOn is always false. By the way, I'm calling the code after playback is started.
Any idea what I'm doing wrong?