Delegate for handling GDPushConnection state transition (deprecated). More...
#import <GDPush.h>
Errors and state changes that occur when using GDPushConnection are handled by creating a class that implements this protocol.
The following code snippets illustrate some common tasks.
@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.
basicDelegate = [[BasicHandler alloc] init]; connection.delegate = basicDelegate;
The above snippet shows how the above handler could be associated with the Push Connection.
- (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:
If the features are available (i.e. isConnected
returns YES
), then any of the following actions that were waiting could now proceed:
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.
status | Internal 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 GDPush
Connection
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.