views:

987

answers:

3

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.

+2  A: 

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.

ceejayoz
You told - "An example would be a Twitter client that sends a notification when the user receives a direct message on Twitter." How can we do the same?
sugar
You'd need a server that's checking Twitter for direct messages. When it detects a new one, it would need to queue up a push notification to that user's phone.
ceejayoz
+1  A: 

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?

Daniel
+1  A: 

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).

titaniumdecoy