System
The System object allows you to get access to system level functions and attributes of the BlackBerry PlayBook.
The System object is static; all of its functions and properties are used directly from the object.
Warning ( Playbook 1.0 Notice):
For URI based APIs, webworks:// has been deprecated and replaced with http://localhost:8472. This change does not affect the procedural APIs.Supported Platform(s)
- BlackBerry OS 5.0+
- BlackBerry PlayBook
- Ripple Emulator
API | OS 5.0 | OS 6.0 | OS 7.0 | PlayBook | Ripple |
---|---|---|---|---|---|
hasCapability | Y | Y | Y | Y | Y |
hasDataCoverage | Y | Y | Y | Y | Y |
hasPermission | Y | Y | Y | Y | Y |
isMassStorageActive | Y | Y | Y | Y | Y |
setHomeScreenBackground | Y | Y | Y | Y | |
http://localhost:8472/blackberry/system/get | Y | Y | Y | Y | |
model | Y | Y | Y | Y | Y |
scriptApiVersion | Y | Y | Y | Y | Y |
softwareVersion | Y | Y | Y | Y | Y |
ALLOW | Y | Y | Y | Y | Y |
DENY | Y | Y | Y | Y | 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 ID | OS 5.0 | OS 6.0 | OS 7.0 | PlayBook | Ripple |
---|---|---|---|---|---|
<feature id="blackberry.system" /> | Y | Y | Y | Y | Y |
Permission Elements (PlayBook Only) |
---|
This API does not require a <permission> element to be declared in the configuration document of your BlackBerry WebWorks Application. |
API Summary
Properties
URI Functions
hasCapability
static Boolean hasCapability(capability : String) |
Supported Platform(s)
- BlackBerry OS 5.0+- BlackBerry PlayBook
- Ripple Emulator
Description
This method will determine if the BlackBerry PlayBook or the BlackBerry Smartphone device is capable of the given service.
hasCapability() returns true if the BlackBerry device is capable of the service; false otherwise.
The supported string values for 'capability' are:
input.keyboard.issuretype (returns if the user is currently using SureType),
input.touch,
media.audio.capture,
media.video.capture,
media.recording,
location.gps,
location.maps,
storage.memorycard (checks for an EXTERNAL SD card only),
network.bluetooth,
network.wlan (WLAN wireless family includes 802.11, 802.11a, 802.11b, 802.11g),
network.3gpp (3GPP wireless family includes GPRS, EDGE, UMTS, GERAN, UTRAN, and GAN),
network.cdma (CDMA wireless family includes CDMA1x and EVDO),
and network.iden.
Returns
Returns true if the device is capable of the given service.Parameter | Type | Description |
---|---|---|
capability | String | The capability being checked for. |
hasDataCoverage
static Boolean hasDataCoverage() |
Supported Platform(s)
- BlackBerry OS 5.0+- BlackBerry PlayBook
- Ripple Emulator
Description
Returns true if the device is in coverage, otherwise returns false. This can be used in conjunction with the blackberry.network property to find out what kind of coverage it is in.
Returns
Returns true if the BlackBerry PlayBook or the BlackBerry Smartphone device has any network interface active.hasPermission
static Number hasPermission(module : String) |
Supported Platform(s)
- BlackBerry OS 5.0+- BlackBerry PlayBook
- Ripple Emulator
Description
Determines the level of access to the requested module.
Returns
The possible return values: 0 - ALLOW 1 - DENYParameter | Type | Description |
---|---|---|
module | String | The BlackBerry WebWorks namespace or class to check for access. For example blackberry.system, blackberry.app. |
isMassStorageActive
static Boolean isMassStorageActive() |
Supported Platform(s)
- BlackBerry OS 5.0+- BlackBerry PlayBook
- Ripple Emulator
Description
Returns whether USB MassStorage mode is active.
Returns
Always returns false on the BlackBerry PlayBook since Mass Storage Mode is not supported. All memory is presented as a network share when connected by USB and is not blocked.setHomeScreenBackground
static void setHomeScreenBackground(uri : String) |
Supported Platform(s)
- BlackBerry OS 5.0+- Ripple Emulator
Description
Set the image that appears as the background of the Home screen on a BlackBerry device.
Parameter | Type | Description |
---|---|---|
uri | String | URI path to an image file that resides in flash memory or a microSD Card. |
Properties:
Property | Type | Description | Supported Platform(s) |
---|---|---|---|
model |
Static String readonly |
Returns the model number of the BlackBerry PlayBook or the BlackBerry Smartphone device.
|
- BlackBerry OS 5.0+
- BlackBerry PlayBook - Ripple Emulator |
scriptApiVersion |
Static String readonly |
Returns the current version of the WebWorks library being used.
|
- BlackBerry OS 5.0+
- BlackBerry PlayBook - Ripple Emulator |
softwareVersion |
Static String readonly |
Returns the current version of the operating system, for example, 1.0.0.0.
|
- BlackBerry OS 5.0+
- BlackBerry PlayBook - Ripple Emulator |
Constants:
Property | Type | Description | Supported Platform(s) |
---|---|---|---|
ALLOW default: 0 | Number |
Returned by hasPermission() indicating that the module requested is accessible.
|
- BlackBerry OS 5.0+
- BlackBerry PlayBook - Ripple Emulator |
DENY default: 1 | Number |
Returned by hasPermission() indicating that the module is not accessible.
|
- BlackBerry OS 5.0+
- BlackBerry PlayBook - Ripple Emulator |
http://localhost:8472/blackberry/system/get
Supported Platform(s)
- BlackBerry OS 5.0+- BlackBerry PlayBook
Description
The objects in hasPermission will always be ALLOW (0). They will correspond to all the entries in the whitelist. If they are not whitelisted, they are omitted from the list. Similarly, all of the objects in hasCapability will be true, otherwise they will be omitted.
Returns
{ "data":{ "hasCapability":[ "location.gps", "media.audio.capture", "media.video.capture", "media.recording", "network.bluetooth", "network.wlan" ], "softwareVersion":"QNX", "hasPermission":[ "blackberry.invoke", "blackberry.system", "blackberry.app", "blackberry.app.event", "blackberry.system.event", "blackberry.ui.dialog", "blackberry.utils" ], "model":100669958, "hasDataCoverage":true, "scriptApiVersion":"1.0.0.0", "isMassStorageActive":false } } |
Code Example(s)
<html> <head> <script type="text/javascript" src="js/jquery-1.4.2.js" ></script> <script type="text/javascript" src="js/jquery.form.js" ></script> <script type="text/javascript" src="js/jquery.populate.js" ></script> <script type="text/javascript"> function getSystemData(){ $.ajax({ type: "get", url: "http://localhost:8472/blackberry/system/get", success: function(msg){ $('#mySystemDiv').populate(JSON.parse(msg).data); } }); } </script> </head> <body> <input type="button" onclick="getSystemData();" value="Populate - System"/> <div id="mySystemDiv"> Software Version: <span id="softwareVersion"></span><br/> Mass Storage Active: <span id="isMassStorageActive"></span> </div> </body> </html>
Code Example(s)
<script type="text/javascript"> // See if we are in coverage if (!blackberry.system.hasDataCoverage()) { alert("You are not in coverage, we will attempt to send later"); } // Check if we have GPS capability if (blackberry.system.hasCapability("location.gps")) { alert("This PlayBook has a GPS."); } </script>