blackberry.com
BlackBerry Dynamics
Runtime library for iOS applications
from the application developer portal

Background Execution

A number of background execution features were added to iOS in the iOS 7.0 release of the operating system.

BlackBerry Dynamics applications can utilize these features, but the following restrictions and limitations apply.

HTTP Session Retrieval

The native NSURLSession class can support background execution for the retrieval of data using HTTP. This interface is for long-running retrieval sessions, taking more than 30 seconds. For details of the native programming interface, see the NSURLSession Class Reference and the documentation for the handleEventsForBackgroundURLSession: function in the UIApplicationDelegate Class Reference on the apple.com developer website.

Connections that run in background cannot be protected by BlackBerry Dynamics secure communication. Background connections won't be made through the BlackBerry Dynamics proxy infrastructure, and cannot be used to retrieve data from a server that is behind the enterprise firewall. Any data retrieved in background using native NSURLSession couldn't be stored in the BlackBerry Dynamics Secure Store. Instead, that data would be stored in the native file system.

Connections that run in foreground can be protected by BlackBerry Dynamics secure communication. See the NSURLSession Support page for details.

Opportunistic Fetch

The application:performFetchWithCompletionHandler: delegate method offers background execution for the opportunistic fetching of data. This interface is for fetches that can be completed within 30 seconds. See the documentation for the performFetchWithCompletionHandler method in the UIApplicationDelegate Protocol Reference on the apple.com developer website for details.

This programming interface can be used by BlackBerry Dynamics applications. The application would register a completion handler block in the usual way. The handler will subsequently be invoked when the normal opportunity arises, but only if BlackBerry Dynamics authorization processing is complete.

Push Notification Fetch

The application:didReceiveRemoteNotification:fetchCompletionHandler: delegate method offers background execution for fetching data in response to a native push notification, i.e. one received from the Apple Push Notification Service (APNS). This interface is for fetches that can be completed within 30 seconds. See the didReceiveRemoteNotification:fetchCompletionHandler: documentation on the apple.com developer website for details.

This interface can be used by BlackBerry Dynamics applications. The application would register a completion handler block in the usual way. The handler must:

  1. Check whether BlackBerry Dynamics authorization processing is complete. Completion of authorization processing will have been notified to the application by the BlackBerry Dynamics runtime dispatching a GDAppEvent with an Authorized code.
  2. Only attempt to utilize secure communication, or any other BlackBerry Dynamics programming interface, if authorization processing is complete.

Note that the application must track GDAppEvent receipt in order to utilize this type of background execution. This should form part of the application's authorization life cycle handling in any case.

If the application attempts to utilize BlackBerry Dynamics secure communication when authorization processing isn't complete, then an error assertion will be generated in the usual way. See under Programming Interface Restrictions in the GDiOS documentation.

See also:
GDAppEvent Class Reference
GDiOS, for details of authorization processing.