blackberry.com
BlackBerry Dynamics
Runtime library for macOS 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 [GDMac 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:[GDMac sharedInstance]];
 }

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

  NSAlert* alert = [NSAlert new];

  if (reachability.isNetworkAvailable)
  {
      [alert setMessageText:@"Success"];
      [alert setInformativeText:@"Network Available"];
  } else {
      [alert setMessageText:@"Error"];
      [alert setInformativeText:@"Network NOT Available"];
  }

  [alert addButtonWithTitle:@"OK"];
  [alert beginSheetModalForWindow:self.view.window completionHandler:NULL];

 }
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.

Property Documentation

- (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: