Creating a WebWorks project
You can use the BlackBerry 10 WebWorks SDK web tool or command-line interface to create a project.
A new project includes all the basic resources required to function as a complete app. The folder structure of a project includes a www folder. This folder is the working directory for your app. All project resource files should be stored in the www folder, or in the appropriate subfolder. See Folder structure of a WebWorks project for the complete folder structure of a WebWorks project.
By default, your app has no access to any of the Cordova or WebWorks APIs. You need to add plugins to access the functionality you want your app to have. For more information about plugins and how to add them, see Adding and removing plugins.
Create a WebWorks project using the SDK web tool
To create a BlackBerry WebWorks project using the BlackBerry 10 WebWorks SDK web tool:
- Open BlackBerry WebWorks <version>. A new browser window opens, displaying the BlackBerry 10 WebWorks SDK web tool.
- In the navigation panel, click [+] beside the Projects heading.
- In the Project Name field, enter your application's name.
- In the Project Path field, enter a project path.
- Click Create.
Create a WebWorks project from the command line
If you choose, you can create a WebWorks project from the command line instead of from the BlackBerry 10 WebWorks SDK web tool. If you create a project from the command line, the project is not initially available in the web tool. However, you can import your project into the web tool at any time. For more information, see Importing a WebWorks 2.0 project into the SDK web tool.
To create a WebWorks project:
- On the command line, navigate to the folder where you installed the BlackBerry WebWorks SDK.
- Run the following command to create a WebWorks
webworks create <path> [<app-id>] [<app-name>]
webworks create c:\webworks-apps\MyApp com.mycompany.myapp "My App"
Check the table below for parameter details:
Specifies the home folder for your project. The tool creates this folder for you and does not overwrite an existing folder; if you specify an existing folder, the project is not created.
Specifies a unique identifier for the app. If provided, this value is used to populate the id attribute of the config.xml <widget> element.
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".
This parameter is optional.
Specifies the name for the app. To specify a name with spaces in it, enclose the value in quotation marks ("). If provided, this value is used to populate the <name> element in the config.xml file.
This parameter is optional.
Once your project is created, you may want to edit the configuration information, for example, to specify a particular orientation or background color. For more information, see Modifying your app configuration.
Folder structure of a WebWorks project
A WebWorks 2.0 project has the following folder structure:
This folder is the root folder, which you specify when you create your project. This folder contains the master config.xml file.
This folder contains platform-specific resources. It should contain a subfolder for each platform you are creating your app for, which contains a duplicate of the /www folder structure.
The SDK uses this folder to maintain platform-specific versions of your project.
A blackberry10 folder is automatically created in this folder, and you can add folders for additional platforms, such as Android or iOS.
When you build your app for a specific platform, the contents of the www/ folder are copied to the appropriate platform-specific folder.
This folder contains any plugins you add to your project. By default, this folder is empty.
For more information on plugins, see Adding and removing plugins.
This folder contains Cordova-specific configuration files.
Importing a WebWorks 2.0 project into the SDK web tool
There are instances where an existing WebWorks project is not available from within the WebWorks SDK web tool. For example, projects that you create from the command line are not displayed in the web tool. In additions, all WebWorks project content that appears in the tool is stored in browser cookies; deleting these cookies removes the project data from the web tool.
You can import a WebWorks 2.0 project into the web tool at any time. To import an existing project into the web tool:
- On the Start menu, click BlackBerry >BlackBerry WebWorks <version>. A new browser window opens, displaying the BlackBerry 10 WebWorks SDK web tool.
- In the navigation panel, click the arrow icon beside the Projects heading.
- In the Project Path field, enter the complete path to the project.
- Click Open.
Last modified: 2014-09-29