I am building a Newsstand
app that I would like to have download the newest issue in the background. I have the appropriate background mode keys set to allow this.
I push a payload to my app, e.g.:
{"aps": {"badge": 1,"content-available":"1"}}
But if my application is not in the foreground, how do I know that the push notification was sent so that I can start the background download? If the app IS in the foreground, I use didReceiveRemoteNotification:
but confused on what to do when the app is not in foreground or isn't even running.
According to the docs:
If an application is not running in the foreground when the notification is delivered, it is activated in the background (or launched into the background, if necessary) to download issue assets. Otherwise, you handle the notification as you would any push notification. See Local and Push Notification Programming Guide for information on how to send and handle push notifications.
The client application communicates with its server and gets URLs locating the issue assets to download. It might also need to obtain the name and date of the issue from the server. In this phase it might also validate that the user is eligible for a subscription or perform any other required authorization.
But it never says which method to use to start the download.