How we can route audio output via speaker even when the headset is plugged in?
My code:
if(audioManager.isWiredHeadsetOn())
{
audioManager.setWiredHeadsetOn(false);
audioManager.setSpeakerphoneOn(true);
audioManager.setRouting(AudioManager.MODE_NORMAL, AudioManager.ROUTE_SPEAKER, AudioManager.ROUTE_ALL);
audioManager.setMode(AudioManager.MODE_NORMAL);
}
Am I missing something here?
Did you try adding <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
to your AndroidManifest.xml ?
http://developer.android.com/reference/android/Manifest.permission.html#MODIFY_AUDIO_SETTINGS
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