Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling remote push notification while offline or airplane mode

Push Notification Service

I am now using OneSignal for push notification service to my iphone

Application State :

Let say my App is running in Background but the device is in Airplane Mode.

I send 3 messages from one signal "Test 1","Test 2","Test 3" in both "body" and "title" which apns offer.

When I switch my Airplane Mode off and back my device to online,only "Test 3" arrive and the remain "Test 1" & "Test 2" didn't appear.

Was it because of APNS notification limitation?I think it more less than 2KB.Did I do something wrong?I really do need a help to guide me.

HELP : So,How to we handle many notification if the device is offline?

like image 402
Thiha Aung Avatar asked Jan 08 '23 00:01

Thiha Aung


1 Answers

Right, APNS only stores one most recent message for devices that are unreachable. This is documented in the Apple Developer Library.

If APNs attempts to deliver a notification but the device is offline, the notification is stored for a limited period of time, and delivered to the device when it becomes available.

Only one recent notification for a particular app is stored. If multiple notifications are sent while the device is offline, each new notification causes the prior notification to be discarded. This behavior of keeping only the newest notification is referred to as coalescing notifications.

If the device remains offline for a long time, any notifications that were being stored for it are discarded.

The most reliable way to ensure that background data is not lost is to instead store the data for each user on your server, then use background notifications to instruct your app to fetch the latest data from your server instead of fetching it from the notification metadata itself.

like image 104
Gdeglin Avatar answered Feb 14 '23 19:02

Gdeglin