• BlackBerry Dynamics
  • Runtime library for iOS applications
  • 12.0.1.79
GDReachability Class Reference

BlackBerry Dynamics infrastructure connection status. More...

#import <BlackBerryDynamics/GD/GDReachability.h>

Inheritance diagram for GDReachability:

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:)
object:[GDiOS sharedInstance]];
}
- (void)reachabilityChanged:(NSNotification *)notification {
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.

Class Methods

(instancetype) + sharedInstance
 Get a reference to the BlackBerry Dynamics infrastructure connection status object. More...
 
(BOOL) + isNetworkAvailable
 Connection availability (deprecated). More...
 

Properties

GDReachabilityStatus status
 Connection status and medium. More...
 
BOOL isNetworkAvailable
 Connection availability. More...
 
BOOL isPushChannelAvailable
 Push Channel availability. More...
 

Method Documentation

◆ sharedInstance

+ (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.

◆ isNetworkAvailable

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

◆ status

- (GDReachabilityStatus) status
readnonatomicassign

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.

◆ isNetworkAvailable

- (BOOL) isNetworkAvailable
readnonatomicassign

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.

◆ isPushChannelAvailable

- (BOOL) isPushChannelAvailable
readnonatomicassign

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:
+[GDReachability sharedInstance]
instancetype sharedInstance()
Get a reference to the BlackBerry Dynamics infrastructure connection status object.
GDiOS
BlackBerry Dynamics Runtime object interface, including authorization.
Definition: GDiOS.h:271
GDReachabilityNotReachable
@ GDReachabilityNotReachable
The infrastructure isn't reachable.
Definition: GDReachability.h:34
GDReachability
BlackBerry Dynamics infrastructure connection status.
Definition: GDReachability.h:62
GDReachabilityChangedNotification
NSString * GDReachabilityChangedNotification
Notification name for changes to BlackBerry Dynamics infrastructure reachability.
GDReachability::status
GDReachabilityStatus status
Connection status and medium.
Definition: GDReachability.h:89