Changes to the config.xml file

Although BlackBerry WebWorks 1.0 and BlackBerry WebWorks 2.0 or later both use a config.xml file to store configuration information for your project, how they are created and used differs slightly.

As of BlackBerry WebWorks 2.0, if you need to manually edit the config.xml file, you can find it your project's root folder.

Reduced need to manually edit the config.xml file

With BlackBerry WebWorks 2.0 or later, there is little need for you to edit the config.xml file manually. Most of the configuration settings can be manged through the BlackBerry 10 WebWorks SDK web tool. A config.xml file is created automatically and prepopulated with template configuration information when you create your project.

You can use the BlackBerry 10 WebWorks SDK web tool to customize the contents of the file. Clicking BlackBerry WebWorks <version> on the Start menu opens the BlackBerry 10 WebWorks SDK web tool. You can click the Configuration button under your project's name in the navigation panel to view and edit most of your app's configuration settings, including the metadata, orientation, background color, and more. The web tool also allows you to add your plugins, and allows you to set any necessary plugin permissions.

The only instance where you need to manually edit the config.xml file is if you want to set up your app as an invocation target. In this case, you must still manually add the <rim:invoke> element and its children to register the app as an invocation target and to define which file types your app can handle.

No need to add <feature> elements to the config.xml file

If you intend to reuse your existing config.xml file, there is no longer any need to add <feature> elements to the config.xml file. The BlackBerry WebWorks tools now handle adding these elements at build time, based on which plugins you've added to your project. For best results, once you have added the required plugins to your project, you should remove all <feature> elements from your existing config.xml.

The <preference> element replaces the <param> element

How you set the configuration parameters associated with the Application API (for example, to define the app orientation or background color) has changed as of BlackBerry WebWorks 2.0.

In BlackBerry WebWorks 1.0, you would define these configuration parameters by adding the following elements to your config.xml file:
<feature id="blackberry.app">
    <param name="orientation" value="portrait" />
</feature>
As of BlackBerry WebWorks 2.0, you must define these parameters using <preference> elements, which are children of the top-level <widget> element. For example, to set the orientation as in the example above, your config.xml file should now contain the following code:
<widget>
.
.
.
   <preference name="orientation" value="portrait" />
</widget>

If you choose, you can set all preferences directly in the BlackBerry 10 WebWorks SDK web tool.

For more information on how to add the <preference> element to the config.xml file manually, see <preference>.

Last modified: 2014-10-09



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

comments powered by Disqus