Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom UI onReceiveCall #9

Closed
PauMateu opened this issue Nov 26, 2020 · 3 comments
Closed

Custom UI onReceiveCall #9

PauMateu opened this issue Nov 26, 2020 · 3 comments

Comments

@PauMateu
Copy link

PauMateu commented Nov 26, 2020

Hi! first of all, thanks for taking the time to merge and share with the community these two plugins, and also to reply and comment on each issue (I've read all of them ;).

Now, we have integrated a call/video-call functionality with a heavily modified version of jitsi meet plugin, with our own UI to accept/decline calls. We are now using a normal push notification to inform users about incoming calls, but this is far from ideal as it can be easily missed. We've been searching for solutions to this problem, and we haven't figured out a way to approach it that is valid for both Android and IOs.

FORCING APP TO THE FOREGROUND
This is the first approach we took, using simple push notifications, we forced the main activity from the native side to the foreground and thus we displayed the app UI. This worked for android versions < 10 (As Android 10 prevents apps from starting a new activity when killed), and, of course, this wouldn't work on iOS.

USING FullScreenIntents ON ANDROID
To bypass the Android 10 situation, we found that fullScreen Intents notifications would work wonderfully as it provided a non-intrusive way to notify the user. However, we couldn't find an equivalent functionality on iOS.

USING CallKit
Now, searching for solutions, we stumbled upon this plugin, and it seems that it could provide a valid solution to our problem. However, we are not sure if this is really doable. As I understood from reading your replies and documentation, using VoIP notifications, we could handle them in foreground and background modes and report a call to iOS. This would, however, open the native Call UI that call kit provides, and it seems that there is no workaround to open the custom UI.

It looks like we are stuck using callkit UI. Maybe this reply @mattkhaw wrote a while ago on this issue could help us.

Since Javascript code cannot be executed, the only way to do so is to modify this plugin to just include an instance of CallKit and report a new incoming call then immediately end it so that the screen doesn't appear to trick the app to launch and execute the plugin callback just to run our Javascript code.

Not sure if this could help us in our use case, but I don't fully understand why to terminate the call just after receiving it (I get the execution of the JS part, but not the motivation with ending the call right away if the user will be in a call anyway).

Do you have any insight on how could we implement this feature? Are we stuck with the native UI, and we have to switch and adapt our code to work with it? Thanks!

@mattkhaw
Copy link
Owner

@PauMateu Pretty much you will be stuck with stock UI for this matter for iOS. To reduce complexity, I highly suggest to do the same with Android. There isn't a workaround for this. The reply I posted earlier is just an idea. After testing this out, it will not work at all because there's a delay between the execution of the code. This means that the native UI will show regardless even though your code immediately ends it. That is the meaning of delay here. Your current logic will only apply for iOS if you build using an older SDK but you won't be able to put it up in the App Store if you have done so since Apple expects you to use the latest SDK. So, you got to weigh which option is the best for you.

@PauMateu
Copy link
Author

Thanks for the quick answer @mattkhaw !

I see that there is no other option to stick with the native UI to handle the calls. As I understand, this is for the signaling part of the call, the way to inform the users they are being called. As for the actual handling when the user clicks the accept button, is it possible to modify the plugin so that it opens our custom activity? I believe that this is what WhatsApp and some similar apps , they use the callkit to inform, and then they launch their app once the user accepts.

If this is possible, do you have any insight on how can we approach this? Should we modify the plugin, or can we handle everything in the JS part (as it will be executed once the call is launched). Or this is not possible at all?

Thanks again!

@mattkhaw
Copy link
Owner

As I've mentioned above, only possible if you are using below iOS 13 SDK to build. However, your app won't be accepted in the App Store because Apple expects all developers to use the latest SDK to create your app. So, no.

@mattkhaw mattkhaw closed this as completed Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants