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

<GDPushConnectionDelegate> Protocol Reference

Delegate for handling GDPushConnection state transition (deprecated). More...

#import <GDPush.h>

List of all members.

Public Member Functions


Detailed Description

Deprecated:
This class is deprecated and will be removed in a future release. Instead of setting a PushConnection delegate, register for notifications as described in the GDReachability class reference.

Errors and state changes that occur when using GDPushConnection are handled by creating a class that implements this protocol.

Code Snippets

The following code snippets illustrate some common tasks.

Print State-Change

 @interface BasicHandler : NSObject <GDPushConnectionDelegate> {}
 @end

 @implementation BasicHandler
 -(void)onStatus:(int)status
 {
     if ( [[GDPushConnection sharedConnection] isConnected] ) {
         NSLog( @"Connected OK. Push Channel service available.");
     }
     else {
         NSLog( @"Push Channel service not available.");
     }
 }
 @end

The above snippet shows a very simple handler for GDPushConnection state-change. The availability of the Push Channel service is written to the system log.

Set Event Handler

 basicDelegate = [[BasicHandler alloc] init];
 connection.delegate = basicDelegate;

The above snippet shows how the above handler could be associated with the Push Connection.


Member Function Documentation

- (void) onStatus: (int)  status

The callback is invoked when the Push Connection changes state, or when an error occurs.

The function that is invoked could call isConnected to determine the availability of the following features:

  • Push Channel service
  • Communication through the Good Dynamics proxy infrastructure

If the features are available (i.e. isConnected returns YES), then any of the following actions that were waiting could now proceed:

  • Establishing a Push Channel, see connect

If the features are not available (i.e. isConnected returns NO) then the function that is invoked could alert the user, or display this as an ongoing state. In this state, Push Channel notifications would not be received.

Parameters:
statusInternal numeric code for the new status. Specific values are not documented, and should not be relied upon.

During establishment or termination of the Push Connection with the Good Dynamics proxy infrastructure, see GDPushConnection connect and disconnect, the callback will be invoked a number of times, as the action progresses.

Events that have an impact on the state of the Push Connection also result in the callback being invoked. This would include loss of network coverage and other losses of data connection, as well as the subsequent automatic re-establishment of the connection.


The documentation for this protocol was generated from the following file: