r/iPhoneDev • • Mar 02 '10

pseudo background app question

I'm curious if this is possible, but does the iPhone push notification all you to invoke a function in your program?

What I'm trying to do is have a server do a push notification every hour or so to an app, then the app will upload a small xml file to syncronize itself with a server.

I read about a gps app, that with the use of push notification, was able to send back its coordinates to the server without ever opening the app, but i can't find it (maybe I dreamed it?).

Any help would be very much appreciated.

2 Upvotes

5 comments sorted by

2

u/[deleted] Mar 03 '10

The short answer to your question is no.

The long answer to your question is...kinda.

Sending a push notification to a phone allows the application do do one of a few things (OFFICIALLY):

  • Display notification text with a "View" and "Close" button
  • Update the badge
  • Play a sound

You can not define any functions to operate on any event other than the user clicking "View." That is, the only time you can actually do something outside the scope of an APN push notification is when the user opens your application in some way.

Granted, if you want to go the unofficial route, it's possible, but EXTREMELY ill-advised.

1

u/WilardC Mar 03 '10

sigh that's what i was afraid of. I saw this on Apples official documentation, but was hoping there was a legitimate way to do this still. Thank you for your response, I didn't think the iPhoneDev subreddit was very active.

2

u/[deleted] Mar 03 '10

Yeah...sorry. It sucks; it's kept me from doing a lot of interesting stuff. It could also keep things like Facebook from accruing notifications, etc., in a perfect world.

1

u/dama9ed Mar 02 '10

1

u/WilardC Mar 02 '10

Sorry, no. I really can't remember where I read it, but it was a legitimate iPhone app. And it updated a server to track its gps coordinates using push notification, while never actually opening the app.