Thursday, January 08, 2009

How to code in WRT for Nokia E71
Location of device

I am writing this for myself to keep track of the steps I took to learn "How to code in WRT for Nokia E71" and the outside reader may discover something useful too.

Task: Within WRT application discover the location of the Nokia E71 device (at NYC:Cutlass studio for example) and send that information as GET request to http://touchtonetours.com/hollywood-usa/delta.php?lat=40.716500&lon=-73.989000 to display the page you see on the cell phone micro-browser.

Story:

1. The AccuWidget example is useful to see how you can local weather information via an RSS feed from line 91 of accuwidget.js [var url = "http://rss.accuweather.com/rss/liveweather_rss.asp?metric=1&locCode=" + locationCode;] however the device user must supply the location code from either a menu or special knowledge. I found the interface clunky but that is often expected with example scripts.

2. Check out http://code.google.com/p/prototypewrt/ for some very useful and good looking examples that help me understand the javascript better. In particular, load accordionDemo.wgz [http://prototypewrt.googlecode.com/files/accordionDemo.wgz] on your Nokia E71 or whatever device and see an elegant tab solution. Sadly, no device lat/lon help here.
(Forum.Nokia.2008 Code Example Challenge = Web Runtime (WRT): Dou Yongwang (Dougcn) from China is awarded the prize for a series of well-documented examples on how to use the Prototype JavaScript library to create nice widgets, using, e.g. accordion.)

Mac OSX Trick 1.1: Download http://prototypewrt.googlecode.com/files/accordionDemo.wgz onto your desktop. Bluetooth > Send file... to your Nokia E71.

Mac OSX Trick 1.2: By right mouse click duplicate the file http://prototypewrt.googlecode.com/files/accordionDemo.wgz that you have just downloaded. Now the file reads 'accordionDemo.wgz copy' so double click the file. The file un-zips and there is a folder with all the components of the WRT (.wgz). Open the folder and launch index.html and see the same micro-browser functionality on your Mac OSX browser. Investigate the code.

3. If I wanted to solve my task by J2ME + Google use link J2ME Google Maps API for useful future exploration. Java ME Location API without Google map.

4. Eclipse + WRT plugin, someday I'll be friends with Eclipse.

5. Arghhh, read entry #7, "...you cannot use location and other system functions through WRT in S60 3rd Edition devices." from Accessing GPS location using WRT - Developer Discussion Boards -- I will solve this tonight!!! Time for Plan B!

6. Wait CS001161 - Obtaining location information WRT on S60 5th Edition may have the beginnings to a solution.

7. Okay, time to bring closure to this. Useful description of Web Developer's Library 1.3 > Guide to Web Developer's Library > Library contents to return to later. Good Location Acquisition API: API description.

8. Check out example Location Service API example from library.forum.nokia.com Web Developer's Library 1.3 > Web Runtime API reference > JavaScript Service API reference > JavaScript Location Service API. I built the WRT and it did not produce location results on my Nokia E71. My conclusion: this is reference document and not a practical example for January 9, 2009.

9. My solution to finish this submission to NAVTEQ Global LBS Challenge Americas due today is http://touchtonetours.com/hollywood-usa/delta.php that looks nice on the Nokia E71.

delta.php

References:
NAVTEQ Global Challenge
forum.NOKIA.com
Map24

Plan B:
The user writes his/her address into my E71 micro browser form. By some PHP script my server looks up some service like geocoder.us: a free US address geocoder (find the latitude & longitude of any US address - for free ... Free lookups are throttled by your IP address to one request every 15 seconds.) that returns the address as latitude and longitude. I drag take the lat/lon through more PHP and finish the task. I have used a variation of Plan B in 2006 for LBS game Hot-n-Cold, semi-finalist in NAVTEQ Challenge.

2 comments:

wallyoh said...

Great post Steve, gave me a leg-up on where to start with developing for Nokia.

Quick question, I am looking into getting my E71 to e-mail me my GPS position. I looked at the Location widget sample on Nokia forum but was not a 100% sure of what they were trying to do.

I was hoping you could help, thanks.

TheRohan said...

Hey guys, Check out the updated version of Web Runtime: BetaLabsWidget

This is a web widget application allows users to browse the applications in Nokia Beta Labs. The application is compatible with Symbian^3 and Symbian S60 5th Edition devices and it has been optimized for the touch UI. The updated version adds tabs and a homescreen widget.

To download the updated version of Web Runtime: BetaLabsWidget Example check the link: http://www.forum.nokia.com/info/sw.nokia.com/id/d8ebc622-3288-41b8-b4bb-037e5d8d279c/Web_Runtime_BetaLabsWidget_Example_v1_1_en.zip.html
wyn