Class: GDPushConnection

GDPushConnection()

The Push Connection is the container and conduit for the device's Push Channels. An application may open multiple Push Channels; all will be managed within a single Push Connection. The Push Connection is automatically established during BlackBerry Dynamics authorization processing, and then maintained by the BlackBerry Dynamics run-time under application control. The application can instruct the run-time to switch the Push Connection off and on. When instructed to switch off, the GD run-time will terminate the Push Connection, and suspend its maintenance. When instructed to switch back on, the GD run-time will re-establish the Push Connection, and resume maintenance. Switching off the Push Connection might be an option that the application offers to the end user, for example, allowing them to reduce power consumption on the device.

Constructor

new GDPushConnection()

Properties:
Name Type Description
onConnected function Callback function to invoke after the connection is established.
onDisconnected function Callback function to invoke after the connection is terminated.
Deprecated:
  • since version 8.0. It will be removed in future versions. Use GDPushChannel class instead.
Source:

Methods

connect()

Call this function to establish, or re-establish, the Push Channel connection with the BlackBerry Dynamics proxy infrastructure Network Operating Center (NOC).
Deprecated:
  • It will be removed in future versions. The connect and disconnect functions are no longer required. They were added to enable management of power consumption by the application code. This is no longer required because of advances in the built-in power management of mobile operating systems and devices.
Source:
Example
window.plugins.GDPushConnection.initialize(function(result) {
    // onConnected code here
}, function(result) {
    // onDisconnected code here
    window.plugins.GDPushConnection.connect();
});

createPushChannel(responseCallback) → {GDPushChannel}

Call this function to create a new push channel to receive notifications from an application server. Push Channels can only be established when the Push Connection is open and operating.
Parameters:
Name Type Description
responseCallback function Callback function to invoke whenever a response is received by this push channel.
Deprecated:
  • It will be removed in future versions. Use GDPushChannel constructor instead.
Source:
Returns:
Type
GDPushChannel
Example
See the example <a href="./GDPushChannel.html">here</a>

disconnect()

Call this function to terminate the Push Channel connection with the BlackBerry Dynamics proxy infrastructure Network Operating Center (NOC).
Deprecated:
  • It will be removed in future versions. The connect and disconnect functions are no longer required. They were added to enable management of power consumption by the application code. This is no longer required because of advances in the built-in power management of mobile operating systems and devices.
Source:
Example
window.plugins.GDPushConnection.initialize(function(result) {
    // onConnected code here
    window.plugins.GDPushConnection.disconnect();
}, function(result) {
    // onDisconnected code here
});

initialize(onConnected, onDisconnected)

Initialize the push connection in prior to establishing the connection. This function should be called before calling GDPushConnection.connect.
Parameters:
Name Type Description
onConnected function Callback function to invoke after the connection is established.
onDisconnected function Callback function to invoke after the connection is terminated.
Deprecated:
  • It will be removed in future versions. See connect and disconnect functions for more info.
Source:
Example
window.plugins.GDPushConnection.initialize(function(result) {
    // onConnected code here
}, function(result) {
    // onDisconnected code here
});

isConnected(responseCallback) → {string}

This function returns the current status of the Push Channel connection.
Parameters:
Name Type Description
responseCallback function Callback function to invoke when the function returns. A single result string will be passed as the input to the callback function: "true" or "false".
Deprecated:
  • It will be removed in future versions. Use isAvailable function in GDPushChannel class instead.
Source:
Returns:
"true" or "false".
Type
string
Example
See the example <a href="./GDPushChannel.html">here</a>

parseChannelResponse(responseText) → {GDPushChannelResponse}

Call this function to transform the push channel response text into a GDPushChannelResponse object.
Parameters:
Name Type Description
responseText string A string representing the push channel response text.
Deprecated:
  • It will be removed in future versions. Use parseChannelResponse function in GDPushChannel class instead.
Source:
Returns:
The push channel response object.
Type
GDPushChannelResponse
Example
See the example <a href="./GDPushChannel.html">here</a>