Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

martinjm

macrumors member
Original poster
Jul 3, 2012
31
2
Is it possible to have an App. perfom some action other than a dialogue when an APN msg is received? In my case it's a 'new data is ready, come get it' msg which should then trigger the App. to retrieve the data.

Thanks,

Martin.
 
Is it possible to have an App. perfom some action other than a dialogue when an APN msg is received? In my case it's a 'new data is ready, come get it' msg which should then trigger the App. to retrieve the data.

Have you read the Local and Push Notification Programming Guide yet? If not, you should. Then come back to this question and see if you can answer it. If you have read the guide, do you have a question about a particular part of handling the notification?
 
Thanks Dejo, I have - but I can't see anything other than the user being notified and then having to take some action - it's this action I want to happen automatically. Of course I may have misread in my old age :D
 
Thanks Dejo, I have - but I can't see anything other than the user being notified and then having to take some action - it's this action I want to happen automatically.

That is unfortunately not what Apple wants developers to do.

Unlike other platforms, they don't want Apps to be able to decide when they run in the background.

If Facebook sends me a friend request Push Notification, I can choose to ignore it (and nothing happens) or press the button to "follow" the notification to the App (the App starts and processes the new data).

The intention is that using push notifications will result in minimal power consumption and low data usage for these activities, while in many cases providing no noticeable difference to the user, compared to the opposite approach of the App always running in the background and being able to use whatever resources it wants.

There are many situations where this doesn't work all that well, and as a consequence some types of App are very difficult to write and then use on iOS. Some are simply impossible.

You may be better off completely rethinking how your App works (if that's possible) in terms of coping with new data.
 
Thanks Dejo, I have - but I can't see anything other than the user being notified and then having to take some action - it's this action I want to happen automatically. Of course I may have misread in my old age :D
No, I don't think you misread. The user has the option to continue or ignore.

What is the reason you feel your update needs to happen automatically? If it were to occur the next time they open the app, would that be sufficient? Because that would be possible.
 
What is the reason you feel your update needs to happen automatically?

It's all to do with reducing time spent on a task (can't say any more!) and having the data remotely preloaded is part of this.


If it were to occur the next time they open the app, would that be sufficient?

It would help.

If the app was in the foreground, would the notification still appear with yes/no, or would I be able to automatically do my stuff?
 
Last edited by a moderator:
If the app was in the foreground, would the notification still appear with yes/no, or would I be able to automatically do my stuff?

That would depend on how you write the Application.

Generally YOU won't send any push notifications to the user when the App is open. Instead YOU would ensure that the Application itself is checking to see if any new data has arrived.
 
Instead YOU would ensure that the Application itself is checking to see if any new data has arrived.

OK, looking slighty better! What's the process for an app to see if it's received an APN?
 
Last edited by a moderator:
I did, but was looking for something else - can't remember it all ! Found it now, cheers.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.