Push Notification send and receive in iOS? - ios

I want to develop an app regarding push notification.
I want to send a push notification to 5 persons who has installed my app and are stored in my directory.
Can I send Push Notification to 5 people using their UDID which I received from each and every person who has installed App. (As UDID is banned)
I want to send them continuously to 5 persons till one does not press OK button on Alert?
Which service should I use for Push Notification?
Is push notification receives on time or it delays?

You cant send the push notification using UDID, you can use the Apple service for sending the push notifications via device-token and pem file which is explained in below link.
http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
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.
Still you have any query then you can refer the below link http://developer.apple.com/library/ios/#technotes/tn2265/_index.html

Related

is there a limit when sending push notifications to multiple iOS devices?

So, I have about 1000 iOS users installed my app.
I tried to send push notification to these users thru my app's backend panel, however, my devices did not receive the push notification. I also asked some users, and some of them said they did receive the push notification and some did not.
I was wondering why not all of the 1000 iOS users receive the push notification successfully.
At first, I thought it has to do with my applications, because my device has the latest update that is yet to release to public. So I went on and delete all the device tokens I got, and register my device again to test the push notification.
This time, my device received the push notification from backend panel successfully. So, I am sure there is nothing wrong with the coding part on receiving push notifications. (I ran multiple test on this and sure that push are send and receive successfully)
It only happens when I tried to send bulk push notifications to iOS users.
so, is sending push notification has a limit? like it only allows to send may be to 100 users?
or may be there are invalid device token so that pushes are stopped before finish sending to all users? but in what situation device token become invalid? will uninstalled user's device token may be a cause?
In our experience notifications have far from a 100% delivery rate, and that's with only between 50 and a 100 installs across iOS. In theory there is no cap set in place.
The only limits I'm aware of is sending an identical notification to the same device multiple times within a short window of time.

iOS Repeat Push Notifications

I have an existing app that receives push notifications. I've been requested to implement a feature where the user must acknowledge the push notification. If the user does not acknowledge the notification, then they will be alerted again after a set time, until they finally do acknowledge it.
So far, the only solution I've come up with is:
We send a notification from our server to APNS. When the user opens the app after receiving a notification, the app will then send an acknowledgement back to the server. If the server does not receive an acknowledgement from the device within X minutes, it will automatically send another notification.
Is there a better way of implementing this kind of feature, where I'm not relying on sending acknowledgments back to the server?
Create Accept/Reject actions for push notification and save that info on server, so that we can differentiate the accepted ones and others

Apple Multiple Push Notifications not visible in Notifications Tray

I basically want to make multiple push notifications in the same application visible in the notification tray in iOS.
This scenario works if my data is on while push notification is triggered via APNS, but only the latest one is received in case I am offline and come back after a while. This functionality is affirmed by APNS documentaion.
However, this is what worked in WhatsApp:
Turned Data Connection OFF
Sent some messages to WhatsApp
Turned Data Connection ON
Saw multiple push notifications received in Apple's Notification Tray
How's this scenario working? Can I use APNS for this? If yes, then how?
See this sample image of multiple Push Notifications in WeChat.
Like you wrote in your question, this is mentioned in the Apple Docs:
If you are sending multiple notifications to the same device or
computer within a short period of time, the push service will send
only the last one.
Link
The only scenario that what you're describing will work is if your whatsApp was open in the background while getting those push notifications. That way whatsApp will handle them as local notifications and will present all of them in the notification center. If whatsApp was closed you'd get only the last notification like any other app.
You can easily test this:
Terminate whatsApp and turn on Airplane mode.
Send your device 5 messages from 1 to 5.
Turn Airplane mode off and lock your device.
You'll only see one msg (the last one you sent aka "5") in your notifications center.
This is how whatsApp is making it work:
While whatsApp is in the background, a single push notification is received (the last one the user sent, "5" in our example). That msg will not be shown to the user.
whatsApp receives it in the method application:didReceiveRemoteNotification:fetchCompletionHandler: and checks against their servers if there are any notifications prior to "5" that the user didn't receive. If that's the case, they will pull that data from their servers and will present it to the user using local notifications which is basically just a way to present data and not related to APNS at all.
It is explained in Troubleshooting Push Notifications. Check for "Some Notifications Received, but Not All" section.
As described you cannot have any control over those push notifications.
However you may know that from iOS7 a new background execution mode (remote-notification) allows the App to be awaken by the system when a push is received, allowing you to process some data, then go back to sleep...
This is probably the trick: using that way to receive the push notifications (silently) and then trigger your own local notification instead as #Segev said. See the UIBackgroundModes here.

Apple push notification without Apple Server

is there a possibility to send Push Notifications to iOS Clients without the use of Apple´s Server´s?!
And on the other Hand is it possible to push a whole file?! like a XML-File for example, or can you just push text messages?!
Another Question, is there any way to push an xml-file to an iOS Client remotely?!
Sorry no this is not possible. With Push notifications the Provider needs to send the notification to the APNS (Apple Push Notification Service) which will send it to the correct device.
This works like:
You are also not able to send files just notifications in the for of Text, sound etc. So no XML file via Push notifications sorry.
You could however do it were you notify the user through Push Notification that there is a file available and then download it when the app opens.
Check here for more on Push Notifications
You can just push text message, sound (actually tell the system to play specific sound on a push, not the actual sound file). All these info are transferred in json format (push notification payload) with maximum size 256 byte and NO there is no way to do it without using Apple Push Notification System (apns).
On your second question you can push the xml file to your app using http request/response (when your app is running, not with push notification).

Limit to send push notification to a device

I am implementing push notification in my app. It was working fine. Right now i am testing this on my development profile. After few times i send push notification to my device, server stops sending any more push notification. I tried searching but can't find anything about the limit. How many times can we send push notification to a particular device token on development as well as distribution profile?
Push notification message size is 256 bytes or below you can send notification number of times .

Resources