Friday, July 31st, 2009...07:12

First webOS App

Jump to Comments

I finished version 0.1 of my first Palm webOS application last weekend. The Palm Pre has a GPS chip in it but there are no applications that expose the raw data, as a dedicated GPS would. As I’m about to embark on a 9 day hike around the rim of Lake Tahoe, I decided to look into what it would take to give the Pre some additional location based functionality which might come in handy on my hike. The goals I set for a version 0.1 application was to clone the basic functionality of Spot:

* Display latitude/longitude/altitude
* Store an emergency contact number
* Easy way to alert emergency contact number of my current location

Of course, before I could get started on any of that, I had to setup a working development environment and familiarize myself with how a webOS application works. Palm has an SDK for Windows, Mac and Linux (Ubuntu). In order to maximize the amount of time I had to work on this, I went with the Linux install, as I have Ubuntu running on my Eee PC and it goes almost everywhere with me. The SDK contains an emulator running inside a virtual machine (VirtualBox). The high-level overview of how development works is:

* Write code
* Package and deploy to the emulated device
* Test
* Repeat
* Deploy to the actual device

There is an Eclipse plug-in, but I have not tried it yet. VirtualBox takes a decent amount of system resources, as does Firefox (open all the time to reference documentation), so running Eclipse as well was not really an option on my Eee PC…

I spent quite a bit of time futzing with the documentation, which while not terrible, wasn’t fully baked yet. If I had to do it all over again, here is how I would structure the initial foray:

  1. Get the HelloWorld application running. This will introduce you to the concepts of stages, scenes and assistants.
  2. Add a file called framework_config.json to the HelloWorld application directory. In this file, put: {“logLevel”:20}. This will instruct the system to log Info and Warning levels in addition to Error. Familiarize yourself woth Mojo.Log and viewing the log for HelloWorld using novaterm.
  3. Build and install the “Style Matters” application found in: /opt/PalmSDK/Current/share. This application is a big demo of lots of the webOS UI widgets. Some of the scenes have source code displayed in them, but it’s sometimes easier to look at the source in the stylematters directory.

At this point you’ll likely have enough knowledge to make quick and meaningful progress building your own application. Depending on what the application will do will likely define what you learn next. Perhaps the most pressing need will be storing client-side data, interacting with services found on the device or running your application “headless”.

Here are a couple of screen shots of the application.

myspot0 Initial startup scene. Upon loading the scene a request is submitted to the location service, which may succeed or fail. I’m currently not handling any error conditions (user hasn’t agreed to allow auto-locate, position can’t be found etc.). One thing worth mentioning is the Pre emulator doesn’t ask you to go through the first-time setup of the device and consequently, the GPS/auto-locate options are not enabled. You’ll need to enable them in the device settings, via the emulator, just as you would on the phone.
myspot1 Clicking More Detail reveals some other data points. Converting them into meaningful data is still a TODO item.
myspot3 From the application menu in the top left corner, you can load a preferences screen where a default contact can be saved.
myspot4 I chose to use the simplest form of persistence; the contact is saved via a cookie. This allows the “Send SMS” button to auto-populate the recipient field when launching the messaging service.
myspot2 I haven’t found a way to auto-send the message yet, another TODO item.

In my field test both the GPS and SMS messaging failed quite a bit due to lack of reception, so it’s certainly not a replacement for Spot, but at least it gave me a taste of what developing a webOS application was like.

Comments are closed.