how to play sound instaed Headset ,from speaker directly on android?
I am trying to play a media file and Listening it on Headset, Now I am trying to give a soft button that using fo开发者_如何学运维r SpeakerOn and Speakeroff.
mAudioManager.setMode(AudioManager.MODE_IN_CALL);
mAudioManager.setSpeakerphoneOn(true);
I have give permission also in Androidmanifest.xml . But on calling these Apis, Mode is changed and using isSpeakerOn() api it showing the speaker status as we expected but In real time I am still getting sound from Headset only not from Speaker?
Give me some guideline so that we can achieve this switching of sound from headSet to Speaker?
Make sure audioManager.setWiredHeadsetOn(boolean on)
set to false
.
精彩评论