0
votes

BACKGROUND

I am buidling a chat messaging applicaiton and I faced a problem handling push notificaton when user receiving message from the sender.

WHAT I WANT TO ACHIEVE

Like Whatsapp does, after I received the push notification and I turned on the airplane mode, I still can see the message contents while I open the app. so, I believe it has gotten the message while receiving the notification.

PROBLEM

I cannot find a good way to handle the remote chat message push notification when the user opens the app through its icon on the home screen instead of pressing or doing another action on the notification.

WHAT I TRIED

I manually loaded the message when the app did apear, but this is not like the tested behavior on Whatsapp. I tried this third party socket library, but iOS killed the listening service once the app was closed, it is not applicable to what I want to build.

MY QUESTION

If still using the push notification or background mode remote notification, is that any way to able to handle the push notification when the app is not running?

I also find out about the Apple PushKit, I not sure if this is only allowed for VoIP providing apps. Does anyone know if Apple will accept my app to be published to their AppStore if I use the PushKit for only text messaging?

The untimate question, how can Whatsapp achieve this? Does it use PushKit as well?

2

2 Answers

0
votes

Actually you can't handle something when your app is killed, so simple solution for you problem is to store all push notifications data in server , get it from server when you run app, and delete them once you got them. I think Whatsapp handle this in same way.

0
votes

Just search about XMPP server, for live chat there is no need for Pushkit, Pushkit is only for Video call notification when app is terminated.

Use XMPP server for live chat integration.

https://code.tutsplus.com/tutorials/building-a-jabber-client-for-ios-xmpp-setup--mobile-7190

What is XMPP, and how can I use it within an iOS chat application?