Giter Site home page Giter Site logo

Comments (8)

mattkhaw avatar mattkhaw commented on June 25, 2024 1

Just make sure that all of the events that are supposed to be called are hooked properly. As I've mentioned before,

As long as CallKit UI is displayed, meaning your app is up and running, which also means that Javascripts can be used.

This will also trigger deviceReady as well. Basically, your app is started normally as if you launch it from the home screen.

from cordova-plugin-callkit.

mattkhaw avatar mattkhaw commented on June 25, 2024

As long as CallKit UI is displayed, meaning your app is up and running, which also means that Javascripts can be used. You can verify this by console logging everything. I think to solve this issue, you can try setting a timeout limit on how long the CallKit UI should remain. Once the limit is reached and no notifications received, then you can just end the call and send a notification to notify the caller. By doing it this way, the app should behave according to what you expected.

Another solution is to not use notifications for signaling and use web sockets instead. By doing so, at least the signaling portion is more responsive since it is almost instantaneous. I'm currently using web sockets for this and it works just fine. I have no issues in ending calls.

from cordova-plugin-callkit.

PauMateu avatar PauMateu commented on June 25, 2024

Indeed, I didn't realize that the JS was running when the call UI is shown to the user. Thanks for clarifying that!

After some testing, I've realized that, despite the function CordovaCall.endCall() being called successfully (the callback onSuccess is executed), the notification UI (the ringing screen) is not hidden and it keeps ringing. Is this the correct way to notify the system that we want the notification to go away? Am I missing something?

Thanks again!

from cordova-plugin-callkit.

mattkhaw avatar mattkhaw commented on June 25, 2024

From what I know, no. If you use CordovaCall.receiveCall() to prompt the UI, definitely use CordovaCall.endCall() to terminate it. However, I noticed that the CordovaCall.endCall() function is called, there's a slight delay in terminating the UI. Maybe you can add a slight delay before calling CordovaCall.endCall()? Maybe that would help?

from cordova-plugin-callkit.

PauMateu avatar PauMateu commented on June 25, 2024

As this plugin is launching the UI automatically after receiving a correctly formatted VoIP, I'm not calling CordovaCall.receiveCall() directly, I'm letting the plugin handle the notification and prompt the UI natively.

Maybe this is why CordovaCall.endCall() is not terminating the UI?

from cordova-plugin-callkit.

mattkhaw avatar mattkhaw commented on June 25, 2024

I'm currently using this plugin, works fine as it is. I can terminate the call screen with no issues.

The plugin instance is declared as a singleton. Like I said, maybe you can add a delay to end the call. See whether that helps or not.

from cordova-plugin-callkit.

PauMateu avatar PauMateu commented on June 25, 2024

After some digging, we found out that indeed this plugin works correctly and we were not handling the push notifications to end the call with the function CordovaCall.endCall() correctly.

Now it works wonderfully when the app is opened or in foreground. When the app is in the background, however, it seems that, when the user receives a call, despite we can use the JavaScript, and the onReject, and onAnswer events that cordovaCall provides, some of cordovas functionality does not get executed: it seems as the deviceReady function is not called, and some plugins (like FCMPlugin) are not loaded correctly, thus making it impossible to handle notifications when the phone is blocked.

Is that behavior normal?

from cordova-plugin-callkit.

PauMateu avatar PauMateu commented on June 25, 2024

Thanks for the reply!

After a lot of searching, we couldn't figure out why some of the plugins were no loaded correctly when the user opened the app via the callKit UI. We solved it calling location.reload() after a call ends and we detect that the plugins were not loaded correctly.
This is far from ideal but it gets the job done for the moment being. Thanks!

from cordova-plugin-callkit.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.