Get App to retrieve data on APN message

Discussion in 'iOS Programming' started by martinjm, Oct 16, 2012.

  1. martinjm macrumors newbie

    Joined:
    Jul 3, 2012
    #1
    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.
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    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?
     
  3. martinjm thread starter macrumors newbie

    Joined:
    Jul 3, 2012
    #3
    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
     
  4. Daveoc64 macrumors 601

    Joined:
    Jan 16, 2008
    Location:
    Bristol, UK
    #4
    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.
     
  5. martinjm thread starter macrumors newbie

    Joined:
    Jul 3, 2012
    #5
    :mad:

    I thought that might be the case. Thanks for confirming.
     
  6. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #6
    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.
     
  7. martinjm, Oct 16, 2012
    Last edited by a moderator: Oct 17, 2012

    martinjm thread starter macrumors newbie

    Joined:
    Jul 3, 2012
    #7
    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.


    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?
     
  8. Daveoc64 macrumors 601

    Joined:
    Jan 16, 2008
    Location:
    Bristol, UK
    #8
    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.
     
  9. martinjm, Oct 17, 2012
    Last edited by a moderator: Oct 17, 2012

    martinjm thread starter macrumors newbie

    Joined:
    Jul 3, 2012
    #9
    OK, looking slighty better! What's the process for an app to see if it's received an APN?
     
  10. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #10
    I thought you said you read the "Local and Push Notification Programming Guide"? Now I'm not so sure I believe you. :(
     
  11. martinjm thread starter macrumors newbie

    Joined:
    Jul 3, 2012
    #11
    I did, but was looking for something else - can't remember it all ! Found it now, cheers.
     

Share This Page