开发者

how to play sound instaed Headset ,from speaker directly on android?

开发者 https://www.devze.com 2023-04-03 12:06 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消