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

Single-Source Manage Push Channel Connection

Deprecated:
This class is deprecated and will be removed in a future release.
  • Instead of isConnected, use GDReachability.isPushChannelAvailable.
  • Instead of setting a PushConnection delegate, register for notifications as described in the GDReachability class reference.
  • The connect and disconnect functions are no longer required. They were added to enable management of power consumption by the application code. This is no longer required because of advances in the built-in power management of mobile operating systems and devices. .

This API is part of the Good Dynamics Push Channel feature. For an overall description of how to use the feature, see under GDPushChannel.

The Push Connection is the container and conduit for the device's Push Channels. An application may open multiple Push Channels; all will be managed within a single Push Connection.

The Push Connection is automatically established during Good Dynamics authorization processing, and then maintained by the Good Dynamics Runtime under application control. The application can instruct the runtime to switch the Push Connection off and on.

When instructed to switch off, the GD Runtime will terminate the Push Connection, and suspend its maintenance. When instructed to switch back on, the GD Runtime will re-establish the Push Connection, and resume maintenance.

Switching off the Push Connection might be an option that the application offers to the end user, for example, allowing them to reduce power consumption on the device.

Push Connection functions cannot be called until Good Dynamics authorization processing is complete.

See also:
GDPushChannel
GDMac, for Good Dynamics authorization
Thread support statement
Background Execution

Push Channel Network

The Push Connection is a link between the mobile application and the Good Dynamics proxy infrastructure Network Operation Center (NOC). The Push Channel is a link between the mobile application and its application server (App Server). There can be more than one Push Channel; the mobile application can receive push communications from more than one App Server. Push Channels are mediated by the NOC, and sometimes other proxy infrastructure elements.

This is shown in the following diagram.

Push Channel network.png

API Overview

The GD Push Connection API consists of a small number of functions that must be used in a particular order. Whilst some other APIs are general-purpose toolkits, the Push Connection API has only a single purpose: to enable the Push Channel API.

The normal sequence of operations is as follows.

  1. Application started.
  2. Good Dynamics initialization and authorization, see under GDMac.
  3. When the application needs a Push Channel...
  4. Call sharedConnection to access the Push Connection object,
  5. Call isConnected to check the connection state,
  6. If the state is not connected:
    1. Set a GDPushConnectionDelegate to handle connection state changes
    2. Call connect to ensure that connection is being attempted,
    3. When the onStatus callback in the handler is invoked, go back and check the connection state again.
  7. If the state is connected, proceed to setting up a Push Channel.

For details of Push Channel set-up, see under GDPushChannel.

Code Snippets

The following code snippets illustrate some common tasks.

Terminate Push Connection

 [[GDPushConnection sharedConnection] disconnect];

After the disconnect, the connection can be re-opened later.

Re-open Push Connection

 if ( ! [[GDPushConnection sharedConnection] isConnected] ) {
     myHandler = [[AppHandler alloc] init];
     myConnection.delegate = myHandler;
     [myConnection connect];
 }

The above snippet shows a check for whether the Push Channel service is already available. If it is not, then a connection is initiated. The connection attempt is asynchronous. The onStatus callback would be invoked, with isConnected returning YES, when the attempt succeeds (not shown). See GDPushConnectionDelegate.