react-native-incall-manager icon indicating copy to clipboard operation
react-native-incall-manager copied to clipboard

setSpeakerPhoneOn not working for incoming call Android

Open easyscripter opened this issue 2 years ago • 6 comments
trafficstars

When il make incoming call and accept . il try setSpeakerPhoneOn but its not working. But for outgoing call its working. I use sip js react-native webrtc and react native incall manager.

const onAccepted = (data: any) => { if (data && data.route === 'incoming') { setCallActive(true); setIsCalling(false); InCallManager.start({media: 'audio'}); RNCallKeep.setCurrentCallActive(currentCallUUID); } else if (data && data.route === 'outgoing') { RNCallKeep.setCurrentCallActive(currentCallUUID); setIsCalling(false); InCallManager.stopRingback(); } }

const handleSpeaker = (isSpeaker: boolean) => { InCallManager.setSpeakerphoneOn(isSpeaker); }

easyscripter avatar Jan 30 '23 09:01 easyscripter

same issue for me I use Android 13

edritech93 avatar Mar 05 '23 03:03 edritech93

Same here. Is a Samsung device @edritech93?

icc-guerrero avatar May 09 '23 07:05 icc-guerrero

Tested with Samsung and Oppo both Android 12 and it didn't work.

Neither setForceSpeakerphoneOn nor setSpeakerphoneOn is working. Looking at the logs, I see it update the defaultAudioMode but it didn't route the audio to the phone speaker.

setForceSpeakerphoneOn() flag: 1 updateAudioDeviceState: wired headset=false, BT state=HEADSET_UNAVAILABLE Device status: available=[EARPIECE, SPEAKER_PHONE], selected=SPEAKER_PHONE, user selected=SPEAKER_PHONE updateAudioDeviceState done

I'm calling the .start before trying to change the audio to the speaker.

mariouzae avatar Aug 02 '23 23:08 mariouzae

If you are using RN-InCallManager in conjunction with RN-CallKeep, remember to call RNCallKeep.toggleAudioRouteSpeaker() after calling setForceSpeakerphoneOn(), for some reason the RNCallKeep has control if you have called the RNCallKeep.startCall() first.

mariouzae avatar Aug 03 '23 11:08 mariouzae

hey @mariouzae, does this work for you 100% of the time?

wilmxre avatar Nov 01 '23 13:11 wilmxre

For me audio switch worked after adding permission in AndroidManifest.xml file

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

elangovansword avatar Nov 09 '23 09:11 elangovansword