widget element

Syntax

<widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:rim="http://www.blackberry.com/ns/widgets"
        version="string" 
        id="string"
        xml:lang="string"
        rim:header="string">
</widget>

Description

The <widget> element provides a container for all other elements and it's the root element in the config.xml file for a BlackBerry WebWorks app.

Parent elements

None

Child elements

Many. For a list of elements, see the Elements in config.xml table.

Occurrences

One, at the root of the config.xml file.

Attributes

You can use the following attributes in the <widget> element:

Attribute Description

xmlns

Defines the namespace for the BlackBerry WebWorks app. The value must be "http://www.w3.org/ns/widgets". If this namespace is missing, the app archive is not valid.

This attribute is required.

xmlns:rim

Defines the namespace for the BlackBerry WebWorks extensions. The value must be "http://www.blackberry.com/ns/widgets".

This attribute is required.

version

Specifies a valid version for the app, in one of the following formats:

  • x.x
  • x.x.x
  • x.x.x.x

If you specify a version number that is not valid, the app archive is not valid.

This attribute is required.

rim:header

Specifies an HTTP header value that precedes every request for data that the app sends. This attribute allows you to distinguish between requests sent from your BlackBerry WebWorks app and those coming from the BlackBerry Browser. The attribute value can be any string.

This attribute is optional.

rim:backButton

Specifies the behavior for the Back button on the BlackBerry smartphone. If you specify this attribute with a value of exit, the Back button exits the app.

By default, the Back button displays the previous screen.

This attribute is optional.

id

Specifies a unique identifier for the app.

Unless you are repackaging an app from another platform, you should use a reverse DNS format for all platforms, for example, id="com.somedomain.HelloWorld".

For BlackBerry smartphone apps running BlackBerry 7 or earlier, this attribute is informational only. Apps you resubmit to BlackBerry World must use a file name that matches the archive file that you previously submitted.

This attribute is optional.

xml:lang

Specifies the language that is used in the element. For more information about this attribute, visit www.w3.org/TR/html401/struct/dirlang.html.

This attribute is optional.

Example

<widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:rim="http://www.blackberry.com/ns/widgets"
        version="2.0"
        rim:header="RIM-Widget:rim/widget">
</widget>

Last modified: 2013-10-02