I am using push notification in an app. Everything is going fine.
Sometimes message sent from server but in app side it does not receive.
In this situation I have to know which message is missing to deliver(app did not receive).
Is there any way to know from server side which message is received by app and which are not?
Turn on notifications for Android devicesTap More on the bottom navigation bar and select Settings. Tap Turn on notifications. Tap Notifications. Tap Show notifications.
Android push notifications sent via GCM / FCM are not reliable due to various issues with GCM's underlying architecture [1] [2] [3]. Push notifications may be delayed, rate-limited, lost in transit, or arrive in a different order than which they were sent.
Sending. The app publisher composes a manual message through a message composer user interface. Alternatively, the publisher sets up an automated message to be sent via the API. The publisher defines the audience to whom the push notification will be sent.
The mobile push notification channel was created in 2009 with Apple's APNs (Apple Push Notification System) for iOS apps. Today, both mobile push notifications are also supported on Android devices.
Apple will not tell you the following:
On the other hand, when the user has opted for Push Notifications then your app can handle this but to a certain extent:
Basically, you could add logic in the -didReceiveRemoteNotification:
and -didFinishLaunchingWithOptions:
to contact your server and tell your server that the message was received.
If it wasn't received within a particular time slot then you can resend it.
But as you see, this could lead to a possible scenario of flooding an innocent user with the same push notifications.
In a sense, harassing him to tap your stupid push notification, which in turn may lead him to switch off push notifications for your app entirely but mostly he would delete the app and maybe even give it a low rating?
Serves you right, I'll say.
Anyways, if you go ahead with this, you would need to implement an identification pattern where you insert a unique message identifier
into the payload of the push notification and when your app gets this push notification, it should send this message identifier
back to the server.
Your server should then log that a particular device token returned a message identifier
, which means it received that particular push notification.
Your server can check on a hourly/daily/whateverly basis and resend a particular message to those device tokens that have not reported back with the relative message identifier
.
Again, this means your server might need to work OT sometimes.
There are other issues with this whole approach:
You can circumvent the last 3 scenarios by having even more logic in your app that queues the message id's that are to be sent to the server and removes it only when the server responds successfully.
So you see, too much work, server-side + client-side.
Plus it's a massive performance degrader on the server-side when dealing with a good volume of users as well as lowering the performance of your app by a wee bit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With