Connection

The Connection object gives access to the device's cellular and wifi connection information.


Beta Notice:

This API is considered to be in Beta. The function and property signatures listed below could change at anytime. Once the API moves out of Beta it will be distributed as part of the core API.



Last Updated: Sun Dec 30 2012 18:15:34 GMT-0500 (EST)

Supported Platform(s)

- BlackBerry 10
View Supported Platform Table
APIBB5.0BB6.0BB7.0PB1.0PB2.0BB10Ripple
type           Y 
BB           Y 
BLUETOOTH_DUN           Y 
CELL_2G           Y 
CELL_3G           Y 
CELL_4G           Y 
ETHERNET           Y 
NONE           Y 
UNKNOWN           Y 
USB           Y 
VPN           Y 
WIFI           Y 
blackberry.connection.connectionchange           Y 

Configuration Document Settings

To use all of the API described for this object, you must ensure the following settings are in your configuration document:

You must declare the feature element(s) below in your configuration document:

Feature IDBB5.0BB6.0BB7.0PB1.0PB2.0BB10Ripple
<feature id="blackberry.connection" />           Y 

Permission Elements (PlayBook and BlackBerry 10+)
This API does not require a <permission> element to be declared in the configuration document of your BlackBerry WebWorks Application.


Properties

String type

Constants

String BB
String BLUETOOTH_DUN
String CELL_2G
String CELL_3G
String CELL_4G
String ETHERNET
String NONE
String UNKNOWN
String USB
String VPN
String WIFI

Events

blackberry.connection.connectionchange


This event is fired by the system. If you want to listen to the event you can do so using the blackberry.event.addEventListener function and remove the listener using the blackberry.event.removeEventListener function.
The connectionchange event is triggered whenever the network connection type changes.


Supported Platforms
 - BlackBerry 10


Parameters
yourCallbackFunction The callback function that will be invoked on the connectionchange event.

info: An object with the pertinent information.
info.oldType: The network connection type prior to the event.
info.newType: The new network connection type.

Code Example:
<script type="text/javascript">

function onChange(info) {
  alert("The network connection type used to be: " + info.oldType + " and is now: " + info.newType);
}

blackberry.event.addEventListener("connectionchange", onChange);

</script>

Properties

static readonly String type


The type of network connection that is being used by the application. Note that CELL_4G is always returned for cellular connection.


Supported Platforms
 - BlackBerry 10

Constants

static String BB


BlackBerry Bridge connection


Supported Platforms
 - BlackBerry 10

static String BLUETOOTH_DUN


Bluetooth tethering connection


Supported Platforms
 - BlackBerry 10

static String CELL_2G


Cellular 2G connection


Supported Platforms
 - BlackBerry 10

static String CELL_3G


Cellular 3G connection


Supported Platforms
 - BlackBerry 10

static String CELL_4G


Cellular 4G connection


Supported Platforms
 - BlackBerry 10

static String ETHERNET


Wired ethernet connection


Supported Platforms
 - BlackBerry 10

static String NONE


No connection


Supported Platforms
 - BlackBerry 10

static String UNKNOWN


Unknown connection


Supported Platforms
 - BlackBerry 10

static String USB


USB connection


Supported Platforms
 - BlackBerry 10

static String VPN


VPN connection


Supported Platforms
 - BlackBerry 10

static String WIFI


Wi-fi connection


Supported Platforms
 - BlackBerry 10

Documentation generated by JsDoc Toolkit 2.4.0 on Sun Dec 30 2012 18:15:34 GMT-0500 (EST)