The Application object provides functions and properties for the currently running application.

Supported Platform(s)
- BlackBerry OS 5.0+
- BlackBerry PlayBook
- Supported Platform Table: Expand

Configuration Document Settings
To use all of the API described for this object, you must ensure the following settings are in your configuration document:
Feature Elements
You must declare the feature element(s) below in your configuration document:
Feature ID OS 5.0 OS 6.0 OS 7.0 PlayBook
<feature id="blackberry.app" /> 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.

Functions


Properties


URI Functions

blackberry.app.exit


static void exit()

Supported Platform(s)
 - BlackBerry OS 5.0+
 - BlackBerry PlayBook

Description
 This function will cause the application to exit.

blackberry.app.removeBannerIndicator


static void removeBannerIndicator()

Supported Platform(s)
 - BlackBerry OS 5.0+

Description
 This function will remove the indicator on the banner.

blackberry.app.requestBackground


static void requestBackground()

Supported Platform(s)
 - BlackBerry OS 5.0+

Description
 This function will move the application to the background.

blackberry.app.requestForeground


static void requestForeground()

Supported Platform(s)
 - BlackBerry OS 5.0+

Description
 This function will move the application to the foreground application.

blackberry.app.setHomeScreenIcon


static Boolean setHomeScreenIcon(uri : String, [hover: Boolean])

Supported Platform(s)
 - BlackBerry OS 5.0+

Description
 This method will set the icon that appears in the Home Screen of the Smartphone.

Returns
Returns true if successful, false otherwise. The hover icon can only be set when the application icon has been set first. Changes made using this API are NOT persisted across PlayBook resets.

Parameter Type Description
uri String Location of the image to use for the icon. The path to the image resource must be fully qualified. An example of a fully qualified path is local:///resourceFolder/icons/icon.png. The path to the resource must also be included in the whitelist. For example, accessing an image on the file system requires 'file:///' to be whitelisted
hover Boolean
Optional
[Default Value: false]

If set to true then the hover icon for the application is changed. By default this is false, so the icon that is changed is the default main icon for the application.

blackberry.app.setHomeScreenName


static Boolean setHomeScreenName(text : String)

Supported Platform(s)
 - BlackBerry OS 5.0+

Description
 This method will set the text for the icon that appears in the Home Screen of the Smartphone.

Returns
Returns true if successful, false otherwise. Changes made using this API are NOT persisted across resets.

Parameter Type Description
text String Text to appear on the home screen icon.

blackberry.app.showBannerIndicator


static void showBannerIndicator(icon : String, [value: Number])

Supported Platform(s)
 - BlackBerry OS 5.0+

Description
 This function will show an indicator on the banner.

Parameter Type Description
icon String The name of the icon to show on the banner. The icon must be a local resource and it's size varies from 10x10 up to 32x32 depending on current theme and device screen size.
value Number
Optional
The number to show on the banner.

Properties:


Property Type Description Supported Platform(s)
blackberry.app.author Static
String
The ID of the author's name that is specified in the config.xml file.
 - BlackBerry OS 5.0+
 - BlackBerry PlayBook
blackberry.app.authorEmail Static
String
The author's email of the BlackBerry WebWorks application that is specified in the config.xml file.
 - BlackBerry OS 5.0+
 - BlackBerry PlayBook
blackberry.app.authorURL Static
String
The author's URL of the BlackBerry WebWorks application that is specified in the config.xml file.
 - BlackBerry OS 5.0+
 - BlackBerry PlayBook
blackberry.app.copyright Static
String
The copyright information of the BlackBerry WebWorks application that is specified in the config.xml file.
 - BlackBerry OS 5.0+
 - BlackBerry PlayBook
blackberry.app.description Static
String
The description of the BlackBerry WebWorks application that is specified in the config.xml file.
 - BlackBerry OS 5.0+
 - BlackBerry PlayBook
blackberry.app.id Static
String
The ID of the BlackBerry WebWorks Application that is specified in the config.xml file.
 - BlackBerry OS 5.0+
 - BlackBerry PlayBook
blackberry.app.isForeground Static
Boolean
A property that will return true if the BlackBerry WebWorks Application is in the foreground.
 - BlackBerry OS 5.0+
blackberry.app.license Static
String
The license of the BlackBerry WebWorks Application that is specified in the config.xml file.
 - BlackBerry OS 5.0+
 - BlackBerry PlayBook
blackberry.app.licenseURL Static
String
The license URL of the BlackBerry WebWorks Application that is specified in the config.xml file.
 - BlackBerry OS 5.0+
 - BlackBerry PlayBook
blackberry.app.name Static
String
The name of the BlackBerry WebWorks Application that is specified in the config.xml file.
 - BlackBerry OS 5.0+
 - BlackBerry PlayBook
blackberry.app.version Static
String
The version of the BlackBerry WebWorks Application that is specified in the config.xml file.
 - BlackBerry OS 5.0+
 - BlackBerry PlayBook

webworks://blackberry/app/get


Description
 Returns a JSON object containing all properties of the application.

Supported Platform(s)
 - BlackBerry PlayBook

Returns
{
	"data":{
		"author":"John Doe",
		"name":"My WebWorks Widget",
		"authorEmail":"jdoe@company.com",
		"authorURL":"www.company.com",
		"description":"A sample widget",
		"license":"Legal stuff goes here",
		"id":"888",
		"version":"1.0",
		"copyright":"Company Ltd.",
		"licenseURL":"www.company.com/license"
	}
}

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 getAppData(){
		$.ajax({
		    type: "get",
		    url: "webworks://blackberry/app/get",
		    success: function(msg){
		      $('#myAppDiv').populate(JSON.parse(msg).data);
		    }
		});
	}
     </script>
     
</head>
<body>

   <input type="button" onclick="getAppData();" value="Populate - APP"/>
   <div id="myAppDiv">
       Name: <span id="author"></span><br/>
       ID: <span id="id"></span>
   </div>
   
</body>
</html>

Code Example(s)


<script type="text/javascript">
	function makeTable() {
		try {
			var details = document.getElementById("details");
			if (details) {
				var output = "";
				output += "";
				output += "";
				output += "";
				output += "";
				output += "";
				output += "";
				output += "";
				output += "";
				output += "";
				output += "";
			
				details.innerHTML = output;
			}
		} catch(e) {
			alert("Exception in displayDetails: " + e);
		}
	}
</script>
Author" + blackberry.app.author + "
Author Email" + blackberry.app.authorEmail + "
Author URL" + blackberry.app.authorURL + "
Copyright" + blackberry.app.copyright + "
Description" + blackberry.app.description + "
ID" + blackberry.app.id + "
License" + blackberry.app.license + "
License URL" + blackberry.app.licenseURL + "
Name" + blackberry.app.name + "
Version" + blackberry.app.version + "

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Sep 14 2011 09:55:29 GMT-0000 (UTC)