Code Example‎ > ‎


Appconfig is used to store data in persistent storage. 

Create a new project

Choose, File --> new project --> project 
Then select Droidget wizards --> project from New Project dialog  
Fill out Project name field, etc  In the Feature section , Click on Add and select Appconfig feature "".  
Then click Finish .
Droidget project with the given name will be created and displayed in the project explorer.


After finished creating project, Bondi Feature <feature name="" required="true"/> will be appeared in the config.xml file as follows.

<?xml version="1.0" encoding="UTF-8"?>
<widget id="AppconfigSample_1279635473326" version="1.0" width="300" height="200">
    <content src="index.html" type="text/html"/>
    <description>The sample of AppConfig</description>
    <author url="">GClue</author>
    <icon src="icon.png"/>
    <license>(c)2010 GClue KK</license>
    <feature name="" required="true"/>

Create Javascript File

create a new folder called js and under that folder create a new file and name it as "script.js".
Then add the following functions.

var KEY = "common.sample0";

// Save
function saveData(mMsg){
    alert("save data");

// Load
function loadData(){
    var value = bondi.appconfig.get(KEY);
    alert("load data:"+value);

Edit index.html

Change the index.html file content as follows. 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <meta http-equiv="Content-Script-Type" content="text/javascript" />
    <script type="text/javascript" src="js/script.js"></script>
    <button onclick="javascript:saveData('TEST');">Save</button>
    <button onclick="javascript:loadData();">Load</button>

Deploy the Widget

Selecte the project from Project Explorer and Click Droidget>>Packaging. Now save and deploy the project
  • From the eclipse menu select Droidget --> packaging
  • Then Droidget-->install packaging
  • upload the Widget to web server and update the download.html file as follows. Then access the download.html from the smart phone and install the widget from URI.

    <a href="droidget://">AppconfigSample</a><br>