'answerCall' Listener occasionally does not run, when answering call while app is terminated/background
See original GitHub issue‘runs pickup’ is never logged to console. I suspect the ‘answerCall’ event occurs before listener is added in some cases. How do you check if app loaded with ‘answerCall’ event. As opposed to detecting an event in real time?
IE If ‘answerCall’ has already occured, then after you add the event listener: RNCallKeep.addEventListener(‘answerCall’, pickupCall), the function will instantly run. Or a way to check if ‘answerCall’ has already occurred when app starts?
Current code:
// Picks up and accepts incoming call.
const pickupCall = async () => {
console.warn('runs pickup'); // <--------- Sometimes Never Runs
setOpenCall({ recipient: {}, inCall: true, isIncomingCall: true });
const id = oneTimeId();
// Tell callkeep that call has begun
RNCallKeep.setCurrentCallActive(id);
// Relay that phone has been picked up
// Just incase this function runs before 'onCallListener'
// If it runs before 'sess.current' will not be the real session
// So methods below will not do anything.
pickedUp.current = true;
// onRemoteStreamListener event gets registered if both phones run this function
const stream = await sess.current?.getUserMedia?.(MEDIA_OPTIONS);
// The function to cause the call to be connected
await sess.current?.accept?.({});
// Setting of localStream video and preparing the remote stream object for incoming remote stream
setLocalStreams([{ userId: 'localStream', stream }]);
setRemoteStreams([{ userId: sess.current.initiatorID, stream: null }]);
};
const callkeepListenersInit = async () => {
console.warn('runs callkeep');
RNCallKeep.setAvailable(true);
RNCallKeep.addEventListener('answerCall', pickupCall);
RNCallKeep.addEventListener('endCall', rejectCall);
};
// Removes all listeners when component unmounts.
const cleanup = () => {
RNCallKeep.removeEventListener('answerCall');
RNCallKeep.removeEventListener('endCall');
hangup();
};
// First mount hooks up all listeners.
useEffect(() => {
cubeListenersInit();
callkeepListenersInit();
return cleanup;
}, []);
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7
Top Results From Across the Web
answerCall' CallKeep Listener occasionally does not ... - GitHub
answerCall' CallKeep Listener occasionally does not run, when answering call while app is terminated/background #517. Open. 2 of 3 tasks.
Read more >answerCall' CallKeep Listener occasionally does not run ...
React Native CallKeep : answerCall' CallKeep Listener occasionally does not run, when answering call while app is terminated/background.
Read more >[Solved]-React-Native: chat over voice-webrtc
As an alternative you can try ConnectyCube React Native video chat. ... Listener occasionally does not run, when answering call while app is...
Read more >Unable To Answer Or See Incoming Calls On Motorola ...
Unable To Answer Or See Incoming Calls On Motorola Phones Easy FIX!! IN THIS VIDEO I WILL SHOW YOU HOW TO BRING BACK...
Read more >reconnect-react-native-callkeep - npm
Tell ConnectionService that the device is ready to make outgoing calls via the native Phone app. If not the user will be stuck...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Someone, please help! 🙏
answerCall
event is not firing in Android only. When we calldisplayIncomingCall
and the incoming call shows on Android, and when we press the call end button, theendCall
event is firing, but when we press the call-accept button, it stays there on the call screen and nothing happens. And theanswerCall
event is not firing.Please help, we’ve tried all the solutions, nothing is working.
I dont know much about your detail situation so I can not help.
About me, I handled that didLoadWithEvents as following: https://github.com/brekekesoftware/brekekephone/blob/master/src/utils/callkeep.ts#L62