Cover by Maximiliano Firtman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

Standards

The standards in this area are still emerging, but we can identify some official and de facto standards in the mobile widget world.

Packaging and Configuration Standards

First, for packaging and for the configuration file, the W3C has the Widget Packaging and Configuration standard, defined at http://www.w3.org/TR/widgets (not only for mobile widgets). The W3C standard defines a ZIP file as the package format, with a configuration file and an optional icon included in the root folder of the package.

The configuration file must be named config.xml. Here’s a sample file:

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
        id="http://mobilexweb.com/widget">
    <name short="Example 2.0">
        The example Widget!
    </name>
    <description>
        A sample widget to demonstrate some of the possibilities.
    </description>
    <icon src="icons/example.png"/>
    <content src="myWidget.html"/>
</widget>

The other de facto standard is the Apple Dashboard Widget, used for Mac OS X widget development. It also uses a ZIP file, and a property list file (info.plist) is used for configuration.

The property list format stores serialized objects in a file with a .plist extension. The contents are in XML format, but without the typical XML tag usage.

In a property file, objects are stored along with their properties. Each property can be a string, a number, a Boolean, an array, a key/value dictionary, or some other type, depending on the system. For each property, we define the name as one

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required