Setting Project Properties
Before you implement the actual application functionality, define all the necessary properties for your application project. To set the application project properties, right-click the project in the Tizen IDE Project Explorer view and select Properties. After setting or changing a property, click Apply.
The settings that you can define in the application project properties include:
You can set the Web application configuration in the config.xml file.
Note |
---|
Only modify the Web application configuration by using the configuration editor in the Tizen IDE. If you create or edit the config.xml file using any other text editor, your application may not work as expected. |
After you have finished setting the project properties, you are ready to design the UI.
Checking API Privileges
You can check the source code in your project for any violation of API privileges. To enable the privilege check:
In the Properties window, select Tizen SDK > Web > Privilege.
-
If you want to exclude JavaScript files in specified folders, you can do so in the Excluded Folder Settings panel.
This configuration helps to avoid unnecessary analysis for library files like jQuery.
To perform privilege checks automatically, select the required option in the Mode Settings panel. To check during the build process, select the Run privilege checks with build option.
You can also perform the checks manually in the IDE by selecting Check Privilege from the context menu. The results are displayed in the Problems view.
Setting Build Properties
You can set build properties for your project. To select the build properties:
- In the Properties window, select Tizen SDK > Package > Web.
- Check Optimize web resources, and add any files for excluding optimization in the Optimization panel.
Setting the JSON Property
You can set a JSON property for your project. To select the JSON property:
- In the Properties window, select Tizen SDK > Web > JSON Properties.
- Check Enable JSON validation in project.
Setting the Web Application Configuration
Every application has a config.xml configuration file. The Tizen IDE provides a Web application configuration editor for configuring the application.
To edit the config.xml file, open it by double-clicking the file in the Project Explorer view.
You can edit Web application properties using the tabs of the Web application configuration editor.
Defining and Editing General Information in the Overview Tab
You can define and edit general information of the Web application in the Overview tab of the Web application configuration editor.
The following table lists the Web application properties you can edit in the Overview tab.
Property | Description | ||||
---|---|---|---|---|---|
Identifier | Web application identifier | ||||
Version | Current version of the Web application | ||||
Name | Web application name that is displayed in an application menu or in other contexts | ||||
Content | Start-up file of the Web application | ||||
Icon | Custom icon for the Web application, displayed in the main menu.
The following icon format and sizes can be used:
|
Defining Web Application License Information and UI Preferences in the Widget Tab
You can define license information and UI preferences of the Web application in the Widget tab of the Web application configuration editor.
The following table lists the Web application properties you can edit in the Widget tab.
Property | Description |
---|---|
Managing the Web Application | |
Author | Person or organization that created the Web application |
Email address of the author | |
Web Site | IRI associated with the Web application, such as a homepage or a profile on a social network |
License | Software license, which can include content, such as a usage agreement, redistribution statement, and copyright license terms, under which the content of the Web application package is provided |
License URL | Valid IRI or path associated with the software or content license |
Description | Free-form Web application description |
Managing the Web application UI | |
Width | Start-up file viewport width |
Height | Start-up file viewport height |
View Modes | Preferred view mode (maximized fullscreen) |
Declaring Required Software or Hardware Features in the Features Tab
You can declare required software or hardware features. This declaration can be used for application filtering in the Tizen Store.
To enable filtering for your mobile Web application:
- In the Feature tab of the Web application configuration editor, click Add.
- Select a feature from the list.
- Click Save.
After setting the feature information with the Web application configuration editor, you can see the added code in the Source tab.
The following example shows the setting in the config.xml file code:
<tizen:feature name="http://tizen.org/feature/network.nfc"/>
For more information on the available requirements for an application package, see Feature Filtering for Web Applications.
Specifying Privileges in the Privilege Tab
You can use features and services provided by privileged APIs, which handle platform and user-sensitive data. You can specify an API, or API groups, accessed and used by the Web application in the Privilege tab of the Web application configuration editor. The tab serves as a standardized tool to request the binding of an IRI-identifiable runtime component for a Web application to use at runtime.
To add a privilege:
- In the Privilege tab of the Web application configuration editor, click Add.
- In the Add privilege window, select an option:
- Internal: Select a privilege from the predefined list of APIs. You can select multiple privileges by holding the CTRL key.
- Privilege name: Manually enter the URL containing a privilege definition.
- File: Click Browse and select a privilege file (with the .xml or .widlprocxml extension).
- Click Finish.
After setting the privilege information with the Web application configuration editor, you can see the added code in the Source tab.
The following example shows the setting in the config.xml file code:
<tizen:privilege name="http://tizen.org/privilege/application.launch"/>
Defining External Access Policies in the Policy Tab
According to the W3C Access Requests Policy (WARP), you cannot access external network resources by default. If you require access to an external network resource, you must request network resource permissions for the Web application using the Policy tab of the Web application configuration editor.
The following table lists the policy properties you can edit in the Policy tab.
Property | Description |
---|---|
content-security-policy | Used to define an additional content security policy for a packaged or hosted application. The policy string is defined according to http://www.w3.org/TR/CSP/ (v1.0).
The following example shows the setting in the config.xml file code: <tizen:content-security-policy> script-src 'self' </tizen:content-security-policy> |
content-security-policy-report-only | Used to define an additional content security policy for a packaged or hosted application (for monitoring purposes only).
The following example shows the setting in the config.xml file code: <tizen:content-security-policy-report-only> script-src 'self'; report-uri="http://example.com/report.cgi" </tizen:content-security-policy-report-only> |
allow-navigation | Used to define a list of URL domains allowed for the Web application.
This attribute is optional. The following example shows the setting in the config.xml file code: <tizen:allow-navigation> tizen.org *.tizen.org <tizen:allow-navigation/> |
access |
Used to define network resource permissions. To request network resource permissions, click Add and enter the resource URLs in the Network URL column. You can allow the Web application to access the URL sub-domains by setting the Allow subdomain column value as true. The following example shows the setting in the config.xml file code: <access origin="http://www.tizen.org" subdomains="true"/> |
After setting the policy information with the Web application configuration editor, you can see the added code in the Source tab.
Setting the Supported Locales in the Localization Tab
You can provide localization support for name, description, and license elements of the config.xml file in the Localization tab of the Web application configuration editor.
To add localization:
- In the Name panel, click Add.
Select a language and enter your name.
The following example shows the setting in the config.xml file:
<name xml:lang="en-gb">Lee</name>
- In the Description panel, click Add.
Select a language and enter the description of the Web application.
The following example shows the setting in the config.xml file:
<description xml:lang="en-gb">Widget</description>
- In the License panel, click Add.
Select a language and manually enter the license and license URI.
The following example shows the setting in the config.xml file code:
<license xml:lang="en-gb" href=" http://www.apache.org/licenses/LICENSE-2.0.html"> Apache License, Version 2.0 </license>
After setting the localization information with the Web application configuration editor, you can see the added code in the Source tab.
You can localize a Web application to adapt to various languages and cultural environments by creating different Web application versions for different languages.
To localize a Web application:
- Launch the Localization Wizard by doing one of the following:
- In the Project Explorer view, right-click the Web application and select Localization > Localization Wizard.
- In the Tizen IDE menu, go to Project > Localization > Localization Wizard.
- In the Localization Wizard view, select the files to localize from the list of files and click Next.
The files that are already localized are grayed out.
- In the Available locales list, select the locales and add them to the Selected locales list. Click Next.
The locales that are already supported are grayed out.
- Associate the selected files with the specified locales by selecting the check boxes under the desired locale column.
The check boxes for files that are already localized for a particular locale are grayed out.
- Click Finish.
In the Project Explorer view, a new locales folder is created containing separate sub-folders for each locale. The sub-folders contain a copy of the selected files. Use that copy to create a localized version of the file.
Figure: Locale folders
Declaring Name-value Pairs in the Preferences Tab
You can declare name-value pairs which can be set and retrieved using the Widget Interface API (in mobile or wearable applications) in the Preferences tab of the Web application configuration editor. These name-value pairs, or preferences, are used by the Web application during execution.
To add preferences, click Add and enter values in the Name and Value columns. You can set a preference as read-only by setting the Read-only column value as true.
After setting the preference information with the Web application configuration editor, you can see the added code in the Source tab.
The following example shows the setting in the config.xml file code:
<preference name="key" value="value" readonly="false"/>
Configuring the Tizen Schema Extension in the Tizen Tab
The Tizen tab of the Web application configuration editor shows the Tizen schema extension. Some of the attributes specified on this tab are mandatory and must be defined, whereas others are optional.
The following table describes the schema extension properties that you can edit.
Property | Description |
---|---|
application | |
ID |
Tizen application ID, which is randomly created from the Tizen package ID and project name. This attribute is mandatory. |
Package |
10-character alphanumeric value used to identify a Tizen application package and automatically assigned by the Tizen SDK. This attribute is mandatory. |
Required version |
Indicates the minimum API version that the Web application supports. This attribute is mandatory and must be a float value, such as 1.0 or 2.0. |
content | |
src |
In Widget Packaging and XML Configuration, the Web application start page is a document within the Web application package. The Tizen WRT allows the start page to be hosted on an external server. The <tizen:content /> element is used to point to the relevant document. |
setting | |
screen-orientation |
Used to set the application screen orientation to landscape or portrait mode, or auto-rotation. This attribute is optional. The default mode is portrait. |
context-menu | Used to set the Web application support for context menus. This attribute is optional. The default value is enable. |
background-support | Used to define whether the execution of the Web application continues when the application is sent to the background. This attribute is optional. The default value is disable. |
encryption | Used to set the encryption of application resources (JS/CSS/HTML files). This attribute is optional. The default mode is disable. |
install-location | Used to set the installation location, for example, the SD card. This attribute is optional. The default mode is auto. |
hwkey-event | Used to set the support for the hardware key. This attribute is optional. The default mode is enable. |
app-control |
Describes the application control functionalities provided by the application. The operation, uri, and mime fields describe the functionalities that other applications can request and the src field describes the application page that handles the request. The following example shows the setting in the config.xml file code: <tizen:app-control> <tizen:src name="edit.html"/> <tizen:operation name="http://tizen.org/appcontrol/operation/edit"/> <tizen:uri name="file"/> <tizen:mime name="image/jpeg"/> </tizen:app-control> |
account | |
Display name |
Used to define the display name of the account provider. This attribute is mandatory. |
Multiple account |
Indicates whether multiple accounts are supported. This attribute is mandatory. |
Icon |
Used to define the path of the icon representing the account provider. The icon image is used by account settings and must be placed in a shared directory. The size is 72 x 72. This attribute is mandatory. |
Small icon |
Used to define the path of the small icon representing the account provider. The icon image is used by account settings and must be placed in a shared directory. The size is 45 x 45. This attribute is mandatory. |
Capabilities |
The capabilities of the account provider defined in the IRI format: http://<vendor information>/accounts/capability/<name> The following predefined capabilities can be used:
This attribute is optional. |
metadata | |
key |
Used to define metadata that can be accessed (read-only) through the Tizen Application API: <tizen:metadata key="key1"/> <tizen:metadata key="key2" value="value"/> This attribute is optional. The value must be a unique string. |
value |
Used to define metadata that can be accessed (read-only) through the Tizen Application API. This attribute is optional. The value must be a string. |
Editing the config.xml File in the Source Tab
The Source tab of the Web application configuration editor shows the code of the config.xml file. You can edit an XML document and immediately see how changes made on the other tabs are reflected in the raw XML source content.
Note |
---|
The config.xml must conform not only to the XML file format but also to the W3C specification requirements. Editing the configuration file in XML format is intended for advanced users only. |