I'm trying to learn about NK. In what cases is an app launched because it has the newsstand flag set in its main plist? My impression is that it isn't launched in that way, because the NK buffers incoming issues. But I am probably wrong so I wonder: Is an NK-aware app ever launched into the background? Thanks.
-
Data is downloaded. Users launch apps. – fearmint Dec 12 '11 at 16:26
-
Thanks Joe. Would you say then that, so long as I'm coding for iOS 5 devices, I would not need to download content myself in the background using beginBackgroundTaskWithExpirationHandler? – Dec 12 '11 at 16:28
1 Answers
My comment was slightly incorrect. The docs say
The following steps describe the general workflow for getting newsstand content when push notifications trigger the download. If push notifications are not involved, skip the first step:
The server side of the application sends a push notification to client applications when there is a new issue to download.
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.
The client gets the shared NKLibrary instance and sends a addIssueWithName:date: message to it, passing in the issue name and date. This step creates an NKIssue object representing the issue and adds it to the library.
I've added emphasis that the app is launched by the push notification.
Yes, newsstand kit apps that use push notifications are launched into the background to download issues. The linked framework reference may answer further questions.
Documentation: https://developer.apple.com/library/ios/#documentation/StoreKit/Reference/NewsstandKit_Framework/_index.html
-
OK. I wonder, how does one detect that an app has been launched into the background? – Dec 12 '11 at 19:21