React Native CallKeep:answerCall'在应用程序终止/后台接听电话时,CallKeep Listener 有时不会运行
有人请帮忙!
Someone, please help! ????
answerCall event is not firing in Android only. When we call displayIncomingCall and the incoming call shows on Android, and when we press the call end button, the endCall event is firing, but when we press the call-accept button, it stays there on the call screen and nothing happens. And the answerCall event is not firing.
Please help, we've tried all the solutions, nothing is working.
And this is my code:
// Register background handler
messaging().setBackgroundMessageHandler(async remoteMessage => {
console.log('Message handled in the background!', remoteMessage);
const callUUID = uuid.v4().toLowerCase()
const number = String(Math.floor(Math.random() * 100000))
RNCallKeep.displayIncomingCall(callUUID, number, number, 'number', false);
// await Linking.openURL("awesome://");
DeviceEventEmitter.addListener("answerCall", (payload) => {
console.log('answerCall', payload); // it doesn't run here
});
});
AppRegistry.registerComponent(appName, () => App);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个非常有用的块,它帮助我实现。你可以试试这个
https://blog.theodo .com/2021/03/react-native-incoming-call-ui-callkeep/
This very helpful block, it helps me to implement. you can try this
https://blog.theodo.com/2021/03/react-native-incoming-call-ui-callkeep/
在FCM背景消息类之外注册您的活动发射器
我必须通过调用endCall方法杀死本机UI,然后导航到相应的屏幕
Register your event emitter outside the fcm background messaging class
I had to kill the native UI by calling the endCall method then navigate to the respective screen