React Native - Show incoming video call screen in Android (VOIP app)

谁说我不能喝 提交于 2020-01-01 16:31:52

问题


I am trying to implement video calling feature in react native app. I have used React native twilio video webrtc. I have implemented the same and got it working.

I don't exactly know the flow of Video calling in mobile apps. The flow which I am using for video calling is as follows:

  1. User 1 taps to call User 2
  2. Your app generates a unique name for a Room. Perhaps a combination of the two user's IDs.
  3. User 1 connects to Room with generated unique name
  4. Using FCM, send message of high priority with the unique name of the Room and token to User 2
  5. User 2 to receives notification and you display a ringing UI(even when the app is killed and phone is locked)
  6. User 2 accepts and connects to the same Room

Now I am stuck on point 5. I am sending the FCM notification(which shows up in tray (edit: now using voip notif) to user2 and now I need to show ringing UI on user2's mobile even if the app is killed and phone is locked. How can I achieve this?

I guess there is a package called react-native-callkit, which I should be using along with PushKit for the same. But the problem is with android flow. PushKit and CallKit is not supported in android. So, when app is in killed state the notification appears I need to grab the control and display ringing UI and wake the screen if the phone is locked and app is killed.

Some Confusions

Is there any special type of push notification which doesn't get displayed in the tray? (edit: data messages and VOIP notif I guess)

Is there any other package than react-native-callkit(for displaying ringing UI) which can be used for both android and ios?


回答1:


Twilio developer evangelist here.

Android doesn't have CallKit, but it does provide the ConnectionService to allow you to build incoming call screen notifications. There's not a lot I can find that connects ConnectionService with React Native, so you may have to check out the Android examples and build this yourself.

Sorry I can't be of more help.




回答2:


I was following the example from Twilio https://github.com/twilio/voice-quickstart-android and then it worked well, even my project in React-Native.



来源:https://stackoverflow.com/questions/53006539/react-native-show-incoming-video-call-screen-in-android-voip-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!