Filtering Apple Push Notification - iphone

I got APNS working perfectly, after many issues with SSL.
Now, I was wondering how I can filter the notifications sent to the devices.
I have to do it server-side, or client-side (app) ?
For example, a Soccer app that sends the latest game scores to the registered devices.
By default, my device shows all notifications sent by APNS (all scores).
What if I want to receive only Real Madrid scores, because I'm a Real Madrid fan?
I keep APNS sending all scores, and I implement the filter in client, or I have to filter in the server side, sending specific payloads to specific devices?

Definitely the server side. Apple specifically state that sending large numbers of notifications to devices that don't want to receive them (either not relevant, or push not enabled etc) - is a bad practice.
Not to mention - if your volume picks up in terms of userbase, you don't want to flatline your link.

Related

Does the Apple Push Notification Service represent a privacy concern?

I've been reading up extensively on APNS, and was curious if anyone is familiar with Apple's stance on server-side logging. In order to allow for push notifications, each device (such as an iPhone) "establishes an accredited and encrypted IP connection with the service and receives notifications over this persistent connection."
Source: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html
This essentially means that Apple tracks every single IP address that a user's phone is connected to at any time including wifi hotspots, and will initiate an automatic connection with its servers when the user enters his/her own home, even when that user is not actually using his/her phone. While I understand this process is essential to allowing for push based notifications, my question is for how long does Apple keep this log data?
(They claim to not log the content of notifications including iMessage here: http://images.apple.com/ipad/business/docs/iOS_Security_Feb14.pdf However, I'm interested in the logging of the metadata associated with those notifications.)

iPhone App communication using phone numbers?

Is it somehow possible to use phone number of receiver to send app messages?
The idea is the user don't have to know anything about ips, etc. just a phone number. Then the app can find this user and send messages (app protocol).
Sorry complete newbie question, but was just wondering if there's a connection… I didn't find any information with search engine…
Yes, you could do this, but it would require both parties to have your app installed and you would likely need to create some sort of intermediate web-based service to store their account information (username, password, phone number, UDID, etc) then use that service to send the app messages from the sender to the receiver.
Assuming both of these users would be using an iPhone it will probably just be easier to wait until iMessage is released with iOS 5 in a month or two since it will work similar to FaceTime in that you can use phone numbers, emails, etc and works between all iOS devices running iOS 5.

Push Notification Alternatives

I heard that push notification is not reliable. What could be the alternative for this?
The use case I am trying to handle is:
1. I have a app which will be shared by three kind of groups. Each group contains certain set of persons.
2. A request is submitted by first kind of group and it will be serviced by second kind of group. So, all persons who are part of second group should be notified and no one apart from them should get the notification.
3. Similarly, A request is submitted by first kind of group and it will be serviced by third kind of group. So, all persons who are part of third group should be notified and no one apart from them should get the notification.
4. Even second group persons can submit a request to third group.
Please provide your thoughts as how should I handle these scenarios.
Push notifications rely on the network (3G/WiFi) presence to deliver the notification. Also, there is no response back from the Apple Push Notification Server which guarantee the delivery of the notification. Having said all these things... iPod touch is higly unreliable for delivery of notification because one, it do not have 3G; second, for saving battery its notifications are internally turned off for some time....
One Alternative to this is to keep polling the server in a background thread for any modification. But this will work only when app is running.
Another Alternative can be writing our own APNS kinda infrastructure.
you're right to say Push Notifications are not reliable.
For one thing, if the device is not connected to the internet, APNs only keeps one push notification to be sent when the device connects again (the last notification sent from the provider). Since there's no way to determine if a notification has been already sent or not after your servers sent them to APNS, you can't even try to queue the notifications on your end.
Other than that if your app depends on PN the user can easily break it's functionality by turning notifications off.
So you're absolutely right, if the data you want to send is critical, then you shouldn't use Push Notification. But I believe there's really no solution to your problem. you simply can't rely on them for your app to work.
I think the best approach would be like the email app for example, where you can download your emails when you start the app wether you have PN turned on or not, and the PN just notify you of new email, even though it's not guaranteed you'll get it at all.
There is no alternative, since Apple does some very low level communication. You would need to work together with the mobile providers to build something like the notification services.
That said, I don't think the service is not reliable. Maybe you should check your implementation.
You are right that APNs does not guarantee delivery: From their docs, they say that:
Important: Because delivery is not guaranteed, you should not depend
on the remote-notifications facility for delivering critical data to
an application via the payload. And never include sensitive data in
the payload. You should use it only to notify the user that new data
is available.

iPhone Push Notification Reliablity

How reliable do you find push notification on the iPhone to be? Does it improve when moving from the sandbox to production server?
I am testing (with the sandbox of course) and have found that notifications are often delayed or not received at all. I am not talking about sending multiple messages and only the last one arriving, as the documentation indicates, but any notification never showing up.
Also, I noticed that if I send a notification with an alert, and then send one with just a badge number, that the second notification will close the alert even after it's already opened. Does this happen between apps as well? For instance, if I send an alert for my app, and then the Facebook app sends a badge, will the Facebook badge close my alert window?
I have no development experience with iPhone apps, but I do know that if you have an unofficial unlocked phone (by using pwnage tool/blackrain etc) then the PUSH notifications might NEVER go through. In fact, it does go through, but to another user's iPhone.
This is because when an iPhone is unofficially network unlocked, it uses the Unique ID of some random individual's iPhone, which causes Push notifications to arrive on either phone (and yes, sometimes also on the unlocked phone it was intended for, but usually not)
Not sure if this is the case with you though, but AFAIK the service is pretty reliable if you follow Apple's rules. :)
The push notification seams better on production. You can always test it using ad-hoc distrbution which uses the production chanel to send the notifications.
I can confirm that production push notifications using
Production Push Notification Certificate
Adhoc Distribution Mobile Provisioning
TestFlight deployment
Production APNS server
works well, no need to publish your app to test production notifications
Production push notifications are not always received. If notifications are machine gunned 1 second apart the first one is received and the rest are not sent, thats my experience.
Where as on a windows phone, they are all received using the windows notification service.

push notification - background process - iPhone

I have just heard that - " push notification " is possible in iPhone
I need following details.
what is push notification ?
How it works ?
What does it requires ?
Any sample code link is available ?
Any documentation link if available ?
Some guidance/tips from "StackOverFlow Masters" about developing the above requirements.
Thanks in advance for sharing your knowledge with Stackoverflow family & me.
The sort of background processing you're looking to do is not possible with push notification.
Push notification allows you to notify the user of something. An example would be a Twitter client that sends a notification when the user receives a direct message on Twitter.
Push notification can not react to things happening on the iPhone when the app is not running. Instead, it depends on you having a server that determines when to send a notification and then sends one.
I'm not seeing any need for background processing in your application. If you store the user's initial location, the next time the app loads you can get their location and calculate the distance between the two. If you're looking for the route travelled, you're out of luck unless you make a deal with AT&T like Loopt just did.
Push notification is not really for that purpose, you should read up on push notification in apples site here http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html, its more for when theres data like a m essage for your user, you can have the user get it without having them open t he application. Now for your purpose, why cant you store the location when htey close the app, once the reopen the app you can reget a location, use the previous location and the new location to calculate the km travelled?
Although only tangentially related to this discussion, I think you might be interested in Loopt's agreement with AT&T to track user's iPhones (for a monthly fee).
Apple Push Notification service (APNs for short) is the centerpiece of the push notifications feature. It is a robust and highly efficient service for propagating information to devices such as iPhone, iPad, and iPod touch devices. Each device establishes an accredited and encrypted IP connection with the service and receives notifications over this persistent connection. If a notification for an application arrives when that application is not running, the device alerts the user that the application has data waiting for it.
Software developers (“providers”) originate the notifications in their server software. The provider connects 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.
Check this link clearly explained Apple push notification services
http://mobiforge.com/developing/story/programming-apple-push-notification-services