Changes to the config.xml file

Although BlackBerry WebWorks and BlackBerry WebWorks 2.0 both use a config.xml file to store configuration information for your project, the way in which they are created and used differs slightly.

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, there is now little need for you to edit the config.xml file manually, as most of the configuration settings can be manged through the BlackBerry 10 WebWorks SDK web tool. A config.xml file is now created automatically and prepoulated 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 adjust many of your app's configuration settings, including author and description information, orientation, background color, and more. The web tool will now also allow 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 will now handle adding these 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

The way in which you set the configuration parameters associated with the Application API (for example, to define the app orientation or background color) has changed. Previously, you would define these by adding the following elements to your config.xml file:
<feature id="blackberry.app">
    <param name="orientation" value="portrait" />
</feature>
In BlackBerry WebWorks 2.0, you must now 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 element.

Last modified: 2014-03-10

comments powered by Disqus