0

I created a simple chat application that sends push notifications to the receiver when he's offline.

As I said in the title, when the app is killed I can't deliver the message correctly via a push notifications. Actually, when the iPhone recevives the push notification and the app is killed, even application:didReceiveRemoteNotification:fetchCompletionHandler is not triggered (as found in the other examples and apple documentation).

However, my app doesn't do any different from whatsapp, but still if I send a push notification via whatsapp even when it is killed the receiver will get his message delivered correctly.

How is this even possible

I read about PushKit and its VOIP push notification mode, but i want to understand if Whatsapp really use this functionality and, if I would use it, will my app risk to be rejected from Apple?

Thanks in advance.

UPDATE:

The test that i did with whatsapp is the following:

  1. Whatsapp on iPhone killed;
  2. Another device send me a message on Whatsapp;
  3. My iPhone receives the Push Notification;
  4. Activate airplane mode on iPhone;
  5. Open Whatsapp with icon app (not with tap on push notification);

Result: The message is correctly there. That makes me think that there is no sort of synchronization when Whatsapp starts but the message data is already delivered on the iPhone.

How is this possible if I can't react to a Push Notification if my app is forced killed?

  • maybe, because it fetches the new messages when it becomes active again...? – holex Jan 23 '17 at 10:24
  • Objective-c or swift. You are using both tags. Refine your tags. – Sushil Sharma Jan 23 '17 at 10:31
  • @SushilSharma Swift – Simone Fusco Jan 23 '17 at 10:52
  • @holex I've added some test details in my UPDATE. – Simone Fusco Jan 23 '17 at 11:01
  • Possible duplicate of [Getting push notification payload when user opens app manually after push has been received in the background](http://stackoverflow.com/questions/21859012/getting-push-notification-payload-when-user-opens-app-manually-after-push-has-be) – holex Jan 23 '17 at 11:15
  • Because Apple considers a users act of killing an app a request not to be bothered by it for some time, they won't wake it for Push Notifications. I'm pretty sure there is a workaround using VoIP. When an app supports VoIP, it will still wake from background to evaluate push notifications. It may not be ok with Apple if you claim your app uses VoIP when it doesn't, so it could get rejected. But one could gamble that they may not even test that functionality. However, in the latest versions of IOS, it is recommended not to kill apps in order to increase battery life. This may not be a problem. – Bjørn Ruthberg Jan 23 '17 at 11:29
  • @holex Thanks for your support but I already read this post. It indicates that the only solution is to call your server to synchronize the app. But this doesn't answer my question; In my test, the message was correctly present in Whatsapp despite the app is killed and airplane mode was on after i receive the push notification. How do you think this is possible? – Simone Fusco Jan 23 '17 at 11:34
  • Hi @Simone Fusco, Have you found the solution for this? – Shubham1164 Feb 12 '19 at 17:07

1 Answers1

0

@BjørnRuthberg Solved it with VOIP Notification.

  • Will my app is still at the risk of reject from Apple or this is the exact solution that whatsapp is using and I should use too. I need an exact similar feature like your question – Shubham1164 Feb 12 '19 at 17:08