IPhone app notifications have a 30 second to 1 min delay - firebase-realtime-database

We have an iPhone app which uses firebase to handle in app notifications (chat notifications, push notifications) which are having a 30 seconds to 1 min delay before they arrive. The Android app does not have this issue. What do we need to correct? Thanks in advance.
The notifications should arrive promptly in real time as they are pushed or a chat message is received. Chat messages are received as floating notifications when the app is minimised.

Related

How IOS apps like Gmail update(decrement) badge counter without push notificatons

Apps in IOS generally show a badge counter telling how many unread notifications are pending for that app. My understanding is that, to update the badge counter, increment or decrement, we need to send a push notification with the current counter value.
I was testing the behaviour of Gmail app, and even if I mark a message as read on my laptop's browser, the counter on App on IOS got decremented to represent the correct value, without receiving any push notification. I had killed the app on IOS before testing it.
I am wondering how Gmail does that. Can silent push notifications, let us update the app badge counter without showing notification alert? Do silent push notifications work at all, when the app is in killed state?
You can update your app's badge count by sending the new count from the server. For example by sending:
{
“aps” : {
“badge” : 9
}
}
As the payload you would set the badge to 9.
For more on the APNS payload, you can check the docs
On iOS it doesn't matter if the app is killed or not to receive a push notification (btw, that's why they are push notifications). In order to update the badge number, you can send the Background Notification (silent notification), which wakes your app so that your app can update, fetch new content.
Read the Docs

How can I get all the iOS push notifications and not just the last one when the app comes back online?

Apple doc says that if there are multiple notifications to be delivered then only the last notification will be delivered to the phone because the Queue size is 1. So If my app goes offline and there are like 40 notifications to be delivered, when my app comes online I only get one notification instead of all 40.
I have tested this with WhatsApp and it gets all the notifications even though the app is killed.
How can I ensure I receive all the notifications as well?

Pushkit VoiP push notifications wake up app execution time

When I receive VoIP push notification while app is removed from the background (using developer APNS), my app wakes up for like 10 minutes.
When I do the same thing, just this time using production APNS, my app wakes up for 8-10 seconds.
What's the trick there? Why production version of the application can't be woken up for at least 30 seconds? Is there any way to extend wake up time, since 10 sec is not eough for all work I have to do?
EDIT
At the end background time wasn't problem. My app was crashing when completely removed form background and woken up by voip notif. I was thinking that it wasn't crash but limited execution time. When I fixed that crash everything was working as it should.
If you want to invoke your app in background while app is in terminated state. Then you can keep Local notification based on pushkit payload.
Also keep sound file in local notification.
So your app will be active in background even if app is been terminated.
App will be active upto local notification sound plays (Max 30 seconds).
Within that duration achieve your things.
Note Your app must have valid category and permissions from Apple to consume pushkit silent notification. Because pushkit is strongly recommended for VOIP based apps only. If your app is not VOIP based then contact Apple for required permission.
Refer pushkit example if you are not aware.
https://github.com/hasyapanchasara/PushKit_SilentPushNotification

Push notification is not being delivered when iPhone comes back online

I'm testing Apple push notifications for our iPhone app. The app deployment target is 6.1 and the iPhone is running 7.1.1. We use Apigee as our push notification provider. The phone receives notifications when it's online via cellular and wi-fi, confirming that registration is correct on the app side and Apigee side. I turn on Airplane mode, push a notification from Apigee, wait 3 minutes, take the phone out of Airplane mode, and the phone never receives the push notification. I wait a few minutes (up to 30), then push another notification from Apigee and the phone receives the notification.
I've read Apple's Local and Push Notification Programming Guide and I've read Technical Note TN2265 Troubleshooting Push Notifications.
According to the troubleshooting guide, "Any push notification that isn't delivered immediately was queued for future redelivery because your device was not connected to the service. "Immediately" of course needs to take latency for your connection into account. Outlying cases would be beyond 60 seconds as APNs will time out at that point." This is why I wait 3 minutes. I also know that APNS queues a single message and I think I know that I'm not overwriting that message - unless latency/throughput with the APNS QoS queue is much worse than a few minutes.
In Apigee, in Message History, I see the notification that was sent when the phone was offline. It has a status of Finished with total sent: 1, total errors: 0. I also see a receipt under Data/receipts. This seems to indicate Apigee successfully sent the notification to APNS (but I'm not 100% sure). I verified that the notifierId from Apigee is the same for all notifications sent when online and offline.
Is there any technique I can use to see why the notification is not being delivered from APNS? Is there anything else I can check?
You are correct, if the Notification is showing no errors and a Receipt has been created, the message was properly delivered to APNS.
The only thing I can think of outside of any vagaries of APNS itself that can affect your delivery is if you set the "expire" property on your Notification. Have you tried to see if that makes any difference to your result?

Get exact date and time for a push notification on an iOS device

Is there a way we can intercept push notification messages sent to my app and log the exact date and time at which it was finally received by the iOS device?
I am using Urban Airship for my push notifications and this is a mission critical app which involves many middle layers so I want to know the exact latency between my first and my last layer (iOS device)

Resources