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"
        rim:userAgent="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

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:userAgent

Specifies the value for the user agent. The value that you specify is sent as the value of the User-Agent header, which is included with every HTTP request. You can use this string to identify requests coming from your app. The attribute value can be any string.

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".

The id attribute is required. If you resubmit an app to BlackBerry World that was initially packaged using a previous version of the BlackBerry WebWorks SDK, the value you specify for this attribute must be the same as the value for the Package-Name in your existing app's .bar MANIFEST file (for example, sampleApp6d5d8d2973ab439a52d274dffa2b018). You can access the MANIFEST file by unzipping the .bar file and viewing it in any text editor.

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.0.0" 
        id="sampleapp"
        rim:header="RIM-Widget:rim/widget"
        rim:userAgent="BlackBerry10/MyWebWorksApp">
</widget>

Last modified: 2014-03-10



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus