VoIP notifications in hybrid apps not working - ios

Recently Apple changed its way of handling VoIP notifications. Now they force you to use CallKit in the same run loop in order not to throw your notification away. The trace I get is this one
Apps receving VoIP pushes must post an incoming call (via CallKit or IncomingCallNotifications) in the same run loop as pushRegistry:didReceiveIncomingPushWithPayload:forType:[withCompletionHandler:] without delay.
When you get this warning three times, the system is "dropping your notifications on the floor".
The problem here is that I'm developing a hybrid VoIP app using the phonegap-plugin-push, and I'm afraid that the on notification event is not fast enough (or at least not the same run loop) for iOS.
Did anyone face this issue?
I've thought of changing to regular push notifications, but I can't find a way to make my app relaunch when it's killed and execute some code (launch CallKit, for example).
Edit:
I'm trying this approach with push notifications and I already configured the background modes. I noticed that sending the "content-available" and some data, like "badge", or "alert" in the notification, the app is launched if it went to background recently. After 15 minutes in the background the push notification arrives but the app doesn't launch anymore
Thank you in advance.

Our app uses CallKit and push notifications, and it launches when a push notification arrives for a new incoming call. It has to be configured in the project build and run once to register with iOS for this, though.

I found a solution:
Since iOS changed its policy about handling voip push notifications, it forces you to report a new incoming call when receiving the voip: https://forums.developer.apple.com/thread/117939
This plugin does it: https://github.com/mattkhaw/cordova-plugin-callkit
It merges two plugins (WebsiteBeaver/CordovaCall and Hitman666/cordova-ios-voip-push). It worked for me. I just had to remove the receiveCall from the javascript and tweak a little bit the plugin.
The methods related to the voip notifications register are in the cordovaCall class, so it is pretty straightforward to work with.

Related

How does WhatsApp bypass APNS restriction to display multiple push messages received while device was offline?

While working with APNS, I was able to have push notifications work flawlessly while device is online.
For any APNS push I send while device is offline, only the last one is received once the device is back online. This seems to be coherent with Apple's Store-and-Forward design.
However - I did notice, that when sending WhatsApp messages to an offline device, once this device goes online it receives all push notifications (one for each message). This is not something based on collapse identifier, but rather independent push notification for each message.
So how did WhatsApp do it?
Tried using Notification Extension and attempt to post multiple local notifications, but this also fails as extensions are not allowed to do that.
Instead of a normal push notification, use a Background Notification, which will not show anything visible, but wake up your app in background. Use this event, to make api call, get relevant data and generate multiple local notifications.
Note the following from the documentation when you implement application(_:didReceiveRemoteNotification:fetchCompletionHandler:) :
system calls this method when your app is running in the foreground or background
system does not automatically launch your app if the user has force-quit it
you must call the block in the handler parameter (fetchCompletionHandler) or your app will be terminated. Your app
has up to 30 seconds of wall-clock time to process the notification
and call the specified completion handler block
Apps that use significant amounts of power when processing remote notifications may not always be woken up early to process future
notifications
Please read relevant documentation completely before making ANY assumptions about how you think this should work.

Make iOS app receive VoIP push notifications again

Apple changed the way VoIP push notifications work. And apps not handling them in the new way stop getting push notifications. The problem: Once this happens, how can I receive push notifications again with an updated application, without reinstalling the app?
(What I'm not asking is how to handle VoIP push notifications. That doesn't help because the app stopped receiving them, so it can't handle them either correctly or incorrectly).
From what I've seen, the only way to receive VoIP notifications again is indeed reinstalling the app. If you can't do so, it seems that in around 24 hours you will be able to receive VoIP notifications again, without doing anything else than waiting.

Voip Push notification stop working in IOS 13

One of my application stop receiving the voip notification from last week.
As per recent IOS documentation, "Repeatedly failing to report calls may prevent your app from receiving any more incoming call notifications." so in this case ,
1) How can we find out wether my app stop receiving any more incoming call notifications? is this data will present anywhere in any console?
2) what needs to be do for receiving the voip again?
Now i have updated my code base as per the documentation but still i am not getting any Voip notification.
I had the same problem, Try to reinstall the app.

PushKit VOIP Push , in a VOIP App. Mixed usage with normal type push?

I am developing a VOIP app, and planning to use PushKit as our push engine. We are using it to send VOIP related push to application, allowing us to setup the call.
However, are we allowed to use the same push engine for other type of messages? like a trigger to refresh news, local database, etc in the background thread.
I mean will they approve this kind of "mixed usage" on app store?
Thanks
Starting on iOS 13, you are no longer able to do so.
Now you must always report a new incoming call when you receive a voip push notification. Not doing so will cause a crash. Repeatedly failing to do so will make your app ignore subsequent voip pushes.

Notification - when app is killed

I have implemented AWS SNS push notification service.
We have an issue which is explained below :
Scenario :
We are trying to save the notification message we receive as a part of requirement.
When the app is killed (swipe out from recent apps) we are able to receive notification, also we are able to save the notification message when we open the message directly from the notification panel it works fine,but when we open the app directly the notification message is not getting saved.
In short we are not able to know if we had received a notification message if we directly open the app rather than clicking the message from the notification panel.
Is this default behavior ? or is there any work around for this ?
Have looked into many posts on about Push Notifications but haven't seen any threads pointing to this scenario.
This is a normal behavior, and there is no workaround.
If your app is killed by the user, it won't be able to run ANY code before it's manually launched again.
If it's manually launched from a notification, this notification's payload will be handled by your AppDelegate.
On top of that, don't forget that Push notifications are Best Effort. That means that they are not reliable, they can be heavily delayed or never delivered at all. Don't rely on Push notifications to achieve any critical work.
If you need to keep a copy of your notifications in-app, keep them server side and fetch them as you would do with any other object.
In order to execute code when the app is killed by the user you need to implement VOIP using PushKit framework provided by apple.
VOIP push unlike regular push notification enables the app to become active even if the app is killed by user.

Resources