how to receive/send multiple iOS push notifications - ios

I have implemented push notifications in my application and receiving them without any issue. Problem occurs when my app is in offline, if I send more than one notification at that time (eg.5 notifications), when my device comes to online it is receiving only the latest notification.
Even when I checked with the apple documentation it is clearly mentioned that APNS will retain only the latest push notification received from 3rd party server.
But how all the other apps like(social networking and chat apps) could able to send multiple notifications when device goes to online from offline.
Do we have to implement specifically or we have any 3rd party providers or frameworks which gives the service.
If any 3rd party providers are giving the service, how they are doing? does apple gives any feedback server whether the notification is delivered to the device or not so that our 3rd party server can send the undelivered message again?

You can resolve this by external services which gives you several advantages:
1) send push notifications asynchronouslly
2) send multiple push notifications
3) easilly subscribe unsubscribe
I have used Urban Airship and have been sutisfied.

Related

Push Notifications without Apple Push Notification Service?

Can one use a 3rd party service to send Push Notifications without relying on the Apple Push Notification Service (APNS)?
If it is a requirement that one use the APNS service, is it simply a requirement for App Store approval or is it a technological limitation?
I have seen other questions, such as this one: Apple push notification without Apple Server, but it mainly deals with sending files and is several years old.
Apple requires you to use APNS to send push notifications to devices. This cannot be done without APNS, if you found a way around this then Apple would most likely reject the app.
Click here to read the documentation. When you register for push notifications you are actually getting the device token for your app on that specific device from APNS, therefore that is an APNS specific token and you will need to use APNS to send the notification.

GCM in iOS - clarification

Just wanted to conform if my understanding is correct. As per my understanding, the mechanism involved in delivering the push notification to iOS App is Server -> GCM -> APNS -> iOS App. I am an iOS developer and I know that Apple strictly never allows a server other than APNS server to send a remote notification to iOS App. So, just wanted to know whether the notification is directly pushed to the iOS App from GCM or, via APNS.
Push messages are always sent by APNS.
What services like Google Cloud Messaging or Parse.com do is facilitating the administration of push messages - eg enabling an app to switch pushon or off for an app, or group users so you can send push messages to certain user groups instead of all of them.
GCM is not involved in Push Notification in iOS.
It is carried out through APNS.
Please refer
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html
It will clear all your doubts.
Everything will be clear if you just look at image:
Its showing complete APNS process. This is the process for iOS, no GCM included for iOS.

PubNub : Route to push notification service even if device is in the foreground

I was wondering if its possible, using PubNub to route a message as a push notification, even if the app is running in the foreground?
One way that I can think to do this is to:
Handle any specific routing and events that need to happen first.
Check the push note portion of the message and send a local device notification. Alternatively any custom UI, etc could be done here.
PubNub does send the push notification when the app is in the foreground. In fact, PubNub (the mobile push notification server) does not know if the device is foreground, background or not running at all. So the push notification is always sent to the device either way.
See the following PubNub Developer Community article, Sending APNS and GCM Messages to Subscribers and Mobile Push Notification Services in One API Call, for more details.
Also refer to the PubNub iOS Mobile Push Gateway Tutorial for Realtime Apps. These docs are about to get a major upgrade in terms of completeness.

Will Apple push notification feedback service report devices that call unregisterForRemoteNotifications

The documentation specifically states that the feedback service will report devices where the app has been uninstalled and won't report devices if the push merely expired.
My question is, will it report devices that have the app installed but the app called unregisterForRemoteNotifications (e.g. the user "signed out" of the app)?
Documentation:
APNs has a feedback service that maintains a per-application list of devices for which there were failed-delivery attempts (that is, APNs was unable to deliver a push notification to an application on a device). Periodically, the provider should connect with the feedback service to see what devices have persistent failures so that it can refrain from sending push notifications to them.
Source: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction.html#//apple_ref/doc/uid/TP40008194-CH1-SW14
The Apple Push Notification Service includes a feedback service to give you information about failed push notifications. When a push notification cannot be delivered because the intended app does not exist on the device, the feedback service adds that device’s token to its list. Push notifications that expire before being delivered are not considered a failed delivery and don’t impact the feedback service.
Source: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW3
My answer is YES, APNS does have this service in place along with its feedback service, mainly because the server triggering the push service will have to be notified back to stop sending push notification to the devices which have manually opted out of push notification service.
And since there is no way this information can reach back to the server directly except through APNS, APNS manages to hold this information to provide it back to the server.

How do iOS Push Notifications work?

How do iOS "push" notifications get delivered to a particular device without that device needing to poll a server?
For example, let's say I have received a new message on Facebook. Facebook notifies Apple that my device should receive a notification as such. But how does Apple know which device/IP to push the message to?
Each device can be updated with data using their own unique device tokens. This picture explains everything . .
It was too much for me to put in a comment so.
From the documentation.
Apple Push Notification service (APNs) propagates push notifications to devices having applications registered to receive those notifications. Each device establishes an accredited and encrypted IP connection with the service and receives notifications over this persistent connection. Providers connect with APNs through a persistent and secure channel while monitoring incoming data intended for their client applications. When new data for an application arrives, the provider prepares and sends a notification through the channel to APNs, which pushes the notification to the target device..
I suggest reading the documentation for more information and how to use and configure. It's all there.
Push Notifications
I created an infographic to explain the workflow of push notifications. Hope this is helpful.
Device does not keep polling the server for the push notifications.
To keep it simple, consider an iPhone is connected to internet. On connecting to internet iPhone establishes connection to Apple Push Notifications server this connection is open connection which means data can be thrown to iPhone from server the moment data arrives to server.
Apple does not use HTTP protocol for Push notifications but if you understand HTTP Protocol its almost a similar methodology.
http://en.wikipedia.org/wiki/Push_technology#HTTP_server_push
There is a really nice exaplanation of push notifications in this article.
In iOS, apps can’t do a lot in the background. Apps are only allowed to do limited set of activities so battery life is conserved.
But what if something interesting happens and you wish to let the user know about this, even if they’re not currently using your app?

Resources