Skip to content

Cordova plugin that enables CallKit + PushKit (iOS) & ConnectionService (Android) functionality to display native UI

License

Notifications You must be signed in to change notification settings

hit0907/cordova-plugin-callkit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOTE

Master branch is not the latest - check "trusted-care-master" for newest code. Basically master had some PushWoosh stuff for Android from the guy that i forked, and there were naming conflicts for Android on the PushNotification plugin that we are using - https://github.com/phonegap/phonegap-plugin-push, therefore i reverted to the original creator last commit and made changes on top of that in the new branch. https://github.com/AleksandarTokarev/cordova-plugin-callkit/tree/trusted-care-master

Regarding Android Push Notifications, we have modified this plugin and you can use this branch from this repo here to achieve Calling https://github.com/AleksandarTokarev/phonegap-plugin-push/tree/android-native-caller

cordova-plugin-callkit

Cordova plugin that enables CallKit + PushKit (iOS) & ConnectionService (Android) functionality to display native UI PushWoosh for notifications.

This plugin is basically a merged of 2 plugins, which are, WebsiteBeaver/CordovaCall and Hitman666/cordova-ios-voip-push, to basically fulfill iOS 13's requirement for VOIP Push Notification. All credits goes to both of them.

For those who are unaware of iOS 13's requirement for VOIP Push Notification, the change being made here is once your app receives a VOIP Push Notification, it is mandatory to inform the OS that there's a new incoming call, otherwise your app will be forced terminated and banned from getting further VOIP Push Notifications if there's too many failed attempts until the app is reinstalled.

Why the merge is essential? This is essential because in iOS 13, Cordova WebView won't initialize if the app is not started, upon receiving the VOIP Push Notification. It is started only when the incoming call is reported hence, everything must be handled natively.

Install

Add the plugin to your Cordova project:

cordova plugin add cordova-plugin-callkit

API Guide

For this, just refer to WebsiteBeaver/CordovaCall and Hitman666/cordova-ios-voip-push and OutSystems/pushwoosh-phonegap-plugin. I'm not gonna be bothered to merge the documentations at all since both of them already provide excellent guides on how to use them. The namespaces in this plugin are identical to both of the repos since this plugin combines both of them into one, like I mentioned above.

Usage

Once the plugin is installed, the only thing that you need to do is to push a VOIP notification with the following data payload structure:

{
  Caller: {
    Username: 'Display Name',
    ConnectionId: 'Unique Call ID'
  }
}

If you need more parameters, just add them into the structure to your liking. Basically, the Username property is mapped to the name displayed on the call screen and the ConnectionId property is mapped to the unique ID for the incoming call (value is optional but property must be provided in the object).

You guys might be wondering, so far it is all about iOS, how about Android? As for Android, no modifications are required for the original plugin since background notifications can handle everything.

Conclusion

I hope that this plugin will help other people out there who is struggling to figure this portion out. Again, I wanted to thank the original creators of these plugins. Without them, I couldn't figure out on how to do all this. If there's any questions, feel free to contact me. I'll try my best to help.

About

Cordova plugin that enables CallKit + PushKit (iOS) & ConnectionService (Android) functionality to display native UI

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 53.9%
  • Java 36.9%
  • JavaScript 9.2%