blackberry.com
BlackBerry Dynamics
Runtime library for iOS applications
from the application developer portal
Static Public Member Functions | Properties

GDReachability Class Reference

BlackBerry Dynamics infrastructure connection status. More...

#import <GDReachability.h>

List of all members.

Static Public Member Functions

Properties


Detailed Description

This class represents the status of the connection from the application to the BlackBerry Dynamics infrastructure.

Every BlackBerry Dynamics application connects to the BlackBerry Dynamics infrastructure whenever possible. The connection is maintained by the BlackBerry Dynamics runtime instance that is embedded in the application. The infrastructure includes the BlackBerry Dynamics Network Operation Center (NOC) as well as a number of other components that can be installed by the enterprise.

The current status can be obtained synchronously. It is also possible to receive notifications whenever the status changes. Use the native NSNotificationCenter programming interface, with the following parameters.

  • Set the notification name to the GDReachabilityChangedNotification value.
  • Set the notification object to the BlackBerry Dynamics runtime interface object, obtained by [GDiOS sharedInstance].
See also:
GDConnectivityManager class reference.
NSNotificationCenter class reference on the apple.com developer website.

Code Snippets

The following code snippets illustrate some common tasks.

Register for notification

 - (void)addChangeConnectionStatusObserver {
  [[NSNotificationCenter defaultCenter] addObserver:self
                                           selector:@selector(reachabilityChanged:)
                                               name:GDReachabilityChangedNotification
                                             object:[GDiOS sharedInstance]];
 }

 - (void)reachabilityChanged:(NSNotification *)notification {
  GDReachability *reachability = [GDReachability sharedInstance];
  if (reachability.status == GDReachabilityNotReachable) {

      UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                      message:@"Network NOT Available"
                                                     delegate:nil
                                            cancelButtonTitle:@"OK"
                                            otherButtonTitles:nil, nil];
      [alert show];

  } else {

      UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Success"
                                                      message:@"Network Available"
                                                     delegate:nil
                                            cancelButtonTitle:@"OK"
                                            otherButtonTitles:nil, nil];
      [alert show];

  }
 }
The above snippet shows:

  • Registration for notification of changes in connection status. The observer code is specified by a selector.
  • Implementation of the selector, which displays a message to the user.

Member Function Documentation

+ (instancetype) sharedInstance

This function returns a reference to the BlackBerry Dynamics infrastructure connection status object, which is a "singleton class".

Returns:
Reference that can be used, for example, to access the status property.
+ (BOOL) isNetworkAvailable
Deprecated:
This function is deprecated and will be removed in a future release. Use the isNetworkAvailable property instead.
Returns:
YES if there is a current connection to the infrastructure.
NO otherwise.

Property Documentation

- (GDReachabilityStatus) status [read, assign]

The value of this property represents the type of connection through which the BlackBerry Dynamics infrastructure is reachable. It always takes a value from the GDReachabilityStatus enumeration:

  • GDReachabilityViaCellular if the infrastructure is reachable via a mobile data (cellular) connection.
  • GDReachabilityViaWiFi if the infrastructure is reachable via a Wi-Fi connection.
  • GDReachabilityNotReachable if the infrastructure isn't reachable.
- (BOOL) isNetworkAvailable [read, assign]

The value of this property represents the availability of the connection to the BlackBerry Dynamics infrastructure.

A change to the availability of the connection will trigger an infrastructure status change notification to the application. See the class description, above, for details of how to register for these notifications. In addition, key-value observing (KVO) can be applied to this property.

- (BOOL) isPushChannelAvailable [read, assign]

The value of this property represents the availability of the BlackBerry Dynamics Push Channel service. For an overall description of how to use the service, see under GDPushChannel.

A change to the availability of the Push Channel service will trigger an infrastructure status change notification to the application. See the class description, above, for details of how to register for these notifications. In addition, key-value observing (KVO) can be applied to this property.


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