Modifying your config.xml file

The config.xml file is an XML file that is used to define the properties of your app. The config.xml file provides general app information, such as the app name, description, start page, and home screen icon; and it specifies the features and functionality that the app can access.

In WebWorks 2.0, there is little need to modify the config.xml file yourself. Most of the entries in the config.xml for your app are added automatically when you use the WebWorks tools, and you can use the BlackBerry WebWorks SDK web tool to modify many of your app's configuration settings.

However, you may need to modify the config.xml manually to add certain configuration information. Specifically, you may need to add some <permit> elements to allow your app access to some functionality. If you want to allow other apps to invoke your app, you also need to manually add the <invoke-target> element and its children to define the invocation behaviour of your app.

Although multiple copies of the config.xml file may exist within your project subfolders, you should edit only the master copy. The master copy of the file is located in your project's root folder. Other versions of the file are overwritten by the tools when a project is built, and any modifications made to those files are lost.

For a list of all the elements that you can use in a configuration document, see Elements in config.xml.

If you edit the master config.xml file, you may notice entries that are not listed in the BlackBerry documentation. You can ignore these entries, as they are used by other platforms. During the build process, the SDK tools strip out any entries that are unnecessary or invalid for the BlackBerry platform before packaging the app resources in a .bar file.

Sample config.xml for BlackBerry WebWorks 2.0

<?xml version="1.0" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:rim="http://www.blackberry.com/ns/widgets"
        version="2.0.0.0" id="sampleapp">

  <author href="http://www.example.com/" 
          rim:copyright="Copyright 1998-2012 My Corp">My Corp</author>

  <name>Sample application</name>

  <description>
    A sample application to demonstrate some features.
  </description>

  <rim:permissions>
    <rim:permit>access_shared</rim:permit>
    <rim:permit>access_location_services</rim:permit>
    <rim:permit>use_camera</rim:permit>  
  </rim:permissions>

  <icon src="icons/icon-150.png"/>

  <rim:splash src="splash-1280x768.png"/>
  <rim:splash src="splash-768x1280.png"/>

  <content src="index.html"/>

  <preference name="orientation" value="portrait" />

  <preference name="backgroundColor" value="0xFFFF0000" />
 
  <access uri="http://www.somedomain.com" subdomains="true" />

  <license href="http://www.example.com/"/>

</widget>

Last modified: 2014-03-10

comments powered by Disqus