Thursday, May 28, 2009

Tech tip: deploying a widget via a website

Hello,

When downloading a file via a browser, we need to give the browser a hint about what to do with it via a MIME type. If this is not provided, the file is simply saved to the filesystem. The Web Developer's Library tells us that...

Specify the MIME type of the widget installation package in the HTTP response header. The MIME type must be application/x-nokia-widget.

The following is an example of how to define the widget MIME type for an Apache server configuration file:

AddType x-nokia-widget .wgz
The w3c is in the process of standardizing widgets. According to the w3c standard for widget packaging and configuration the MIME type is application/widget. At some point, I expect a future version of WRT to migrate to this standard.

Here is the behavior I am seeing at the moment. After the widget is downloaded, the user will need to open it with the file manager. This can be done in the browser from the options menu. In the file manager, they need to go to the download directory and open the .wgz file they just downloaded. This will start the normal installation process.

I suspect the host hasn't been configured with the right MIME type. I expected the browser to launch the installer directly. It you can log into the machine where the http server is running, this is pretty straight forward to confirm. In this case, I don't. So, I'll be looking to intercept the http traffic. I'll bet I can do it with telnet. Anyway, I'll update this blog when I get to the bottom of it.

-jk

Tuesday, May 19, 2009

What's a minimal widget?

Hello,

I like to understanding what is required for a minimal application. Not only does one understand what is required but you learn to appreciated the functionality provided by what is optional. Let's consider a minimal Symbian/S60 widget. It is composed of two files info.plist and an html file.

info.plist is an xml file containing key value pairs. It must define the application name, an identifier and the html file. Here is a example.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Nokia//DTD PLIST 1.0//EN" "http://www.nokia.com/NOKIA_COM_1/DTDs/plist-1.0.dtd">
<plist version="1.0">
<dict>
<key>DisplayName</key>
<string>Kilroy</string>
<key>Identifier</key>
<string>org.symbian.widget.kilroy</string>
<key>MainHTML</key>
<string>Main.html</string>
</dict>
</plist>

The only constraint on the html file is the name. We just defined it in the info.plist file. Here is a trivial html file which must be named Main.html.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Kilroy</title>
</head>
<body id="body">
The sky is so beautiful. I can bite my toes.
</body>
</html>

Deploying is pretty simple:
  1. Assuming these two files are in there own directory, we can simply zip it up. Users of the Windows Explorer and Send To a compressed folder.
  2. Rename the file extension from zip to wgz.
  3. send it over to the phone. I used Nokia's PC Suite.

Now let's turn our attention to the phone. This minimal widget will show up on the phone like any other application. Launch the application which we called kilroy. Not too exciting. You should see a white screen displaying the text from the html file. Developer's will appreciate that no signing was involved. User's will appreciate not having to entry a URL on the phone and that it is ease to launch the application.

-jk

Monday, May 18, 2009

tech tips: finding Web runtime examples

Where can you find example code for WRT? The Symbian^1 SDK (aka Symbian/S60 5th edition) provides a dozen or so examples. They are organized like a collection of little recipes. For example,
  • send a message
  • get location information.
  • getting access to the calendar/contacts
The Aptana IDE provides a few templates to seed your projects. These include an RSS reader and a Flickr application.

-jk

Thursday, May 14, 2009

Symbian Programming SIG on Web Runtime

What: The initial release from the Symbian Foundation will be based on Symbian/S60 5th edition and is called Symbian^1. One interesting implication for open sourcing Symbian/S60 is the Web Runtime(WRT) is part of the mix. This allows programmers to use standard web technologies like javascript, html and css to deliver applications to the phone. Unlike native applications, no signing is required. In addition to extending JavaScript for the phone UI, the WRT allows to access the phone via the Platform Services API. This talk is an introduction to it.
Who: John Kern
Date: Tuesday, June 9th, 2009, 6:30pm (registration), 7pm(talk)
Where: Symbian Foundation at 1051 E Hillsdale Blvd, Foster City, CA 94404 ( map ).
Cost: free but registration is required. Check here to register.

Update: Jo Stichbury, a well known Symbian author, is planning to attend.

Monday, May 11, 2009

Placing a call with the WRT.

Hello,

Symbian/S60's Web Runtime has a rich set of javascript extensions called Platform Services: contacts, calendar, location, logging, media, messaging, etc. Nice but how does one make a call. It is a phone after all. Turns out there is the well known tel URI protocol. The syntax is simply tel:<number>. This can be used directly in an href or in javascript.

var url = "tel:123-123-1234";
widget.openURL(url);

Here 123-123-1234 represents a generic phone number.

-jk

Thursday, May 07, 2009

Symbian, the Web Runtime and Aptana

Hello,

Recently, I joined the Symbian Foundation which is at the epicenter of open sourcing Symbian/S60. The initial releases of the will based on S60 5th edition and is called Symbian^1. One interesting implication for open sourcing Symbian/S60 is the Web Runtime(WRT) is part of the mix. This allows programmers to use standard web technologies like javascript, html and css to deliver applications to the phone. Unlike native applications, no signing is required. In addition to extending JavaScript for the phone UI, the WRT allows to access the phone via the Platform Services API.

Aptana is an IDE which can be used to build web widgets for Symbian. It helps to create, edit and deploy applications to the phone. Unlike native S60 development, you can do all of this on Mac OS X because Aptana does provide a preview mode for the application. On windows, you still may want both Nokia's PC Suite and the SDK. The PC Suite makes pairing bluetooth devices (like your pc and phone) ease. The emulator in the SDK provides a much more faithful emulation of the phone.

While Aptana does not allow one to debug javascript, integration with firebug is on their roadmap.

-jk