I want to play sound in an app only if it is NOT played through the phone's built in speaker. To do this, I assume I need to find out if there is an external speaker connected (wired speaker, bluetooth headset, wired headset, etc).
I see that AudioManager.isWiredHeadsetOn()
is deprecated but still works, however this only shows that a wired headset is plugged in. Is there a similar option for bluetooth? Will that cover all the possible audio options?
Conversely, if there is a way to tell that sound WILL be routed through the built in speaker, that would probably work just as well.