×
Namespaces

Variants
Actions

Bondi Widget porting example - geolocation API

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: User:Miasa (18 Nov 2009)
Last edited: hamishwillee (05 Jul 2012)

Needs-update.pngThis article needs to be updated: If you found this article useful, please fix the problems below then delete the {{ArticleNeedsUpdate}} template from the article to remove this warning.

Reasons: hamishwillee (01 Jun 2011)
The article is dependent on a wgt package from Bondi that is no longer available (geo.wgt) because the site has merged with another. If anyone can find the linked package this header can be removed.

Contents

Preface

This is an example of porting a Bondi Widget to Nokia WRT using the guide found here. The example widget uses Bondi API specific geo-location and file-system functions. It gets the location via GPS, saves the location to file-system and displays a map based on the given latitude and longitude.

NOTE: The Javascript wrapper library currently supports only geo-location functions, file-system functions are not supported.

1. Download the .wgt package

The Here I am! widget package can be found by following this http://bondi.omtp.org/widget-gallery/Lists/Widgets/Attachments/7/geo.wgt link. This porting example was written using the Here I am! widget version 1.0. The link may require login credentials for the Bondi website.

2. Rename and unzip the Here I am! widget archive

The archive needs to be unzipped to make modifications to its contents. First rename the file extension from *.wgt to *.zip. Then extract the zip archive.

3. Create info.plist manifest file

When installing a .wgz file the system looks for a manifest file called info.plist. The Bondi Widget equivalent is called config.xml.

Here's how to use the Bondi Widget config.xml data to create the WRT manifest file:

  1. Download and unzip this info.plist template file and save it in the widget's root directory.
  2. Open the widget's config.xml file and find the <name> element. Copy the text found within the element and paste it into the <string> element under <key>DisplayName</key> element of the info.plist file.
    <key>DisplayName</key>    
    <string>Here I am!</string>
  3. The identifier of a Bondi widget can be found in the id attribute of the <widget> element in config.xml. If the value is a URL, use the conventional WRT identifier form, which is the URL in reverse. Add the identifier to <string> element under <key>Identifier</key> element of the info.plist file.
    <key>Identifier</key>       
    <string>net.webvm.bondi.geo</string>
  4. The HTML-file can be found in the src attribute of <content> element.
    <key>MainHTML</key>
    <string>geo.html</string>
  5. This widget requires network access so it should be set to true.
    <key>AllowNetworkAccess</key>   
    <true />
  6. Rename the icon from aplix.png to icon.png.
  7. Save the file.

4. Add Javascript wrapper libraries

  1. Copy Bondi.txt and Platformservices.txt and save them to the widget's root directory. Change the extensions from *.txt to *.js.
  2. Add the following lines inside <head> element in main HTML file:
<script type="text/javascript" src="Bondi.js"></script>
<script type="text/javascript" src="Platformservices.js"></script>

5. Packaging

Re-zip the containing Here I am! widget folder and change the file extension from *.zip to *.wgz.

6. Deploy

Upload the widget to your mobile device and install.

Here is an example of the ported widget. Remember to change the extension to .wgz before installing.

This page was last modified on 5 July 2012, at 04:58.
61 page views in the last 30 days.
×