Re: PhoneGap and W3C Widgets convergence

On Mon, Dec 21, 2009 at 11:59 AM, Robin Berjon <robin@berjon.com> wrote:
> Hi,
>
> I just noticed ACTION-345 "Investigate possible convergence of PhoneGap and W3C Widgets" [0].
>
> Just as an FYI:
>
>  - the DAP WG is taking input from PhoneGap into consideration, and is looking at PhoneGap as a potential implementation vector — this is not directly related to widgets per se, but having the same APIs makes using the same packaging format a whole lot more useful;
>
>  - and more to the point, Dan Brickley (copied) has been toying with making PhoneGap able to take a W3C Widget as input to essentially "compile" it for the various target platforms. This is similar to the approach that RIM uses whereby they munge widgets into another format that works with their Java-based stack.
>
> I don't know how far Dan's gone with his experiment and I certainly don't want to put him on the spot (Hi Dan!) but it'd be a shame if Noah had to duplicate investigation that's already been performed.

I can summarise my brief investigations easily.

Background: I have an iphone, and my local machine is already
configured for mainstream iphone development (including massive hassle
of setting up provisioning profiles, account on the developer portal,
etc.). So my machine and Xcode installation was already set up nicely,
eg. I regularly build and install my own full iphone app-in-progress.

So - I downloaded PhoneGap, skimmed the docs, and generated /
installed the xcode addon. This lets me create "PhoneGap-based"
projects within XCode. For example, just now I went to "New Project"
and made one called "hello_robin". Here is the filetree:

dyn26-234:hello_robin danbri$ find .
.
./build
./build/hello_robin.build
./build/hello_robin.build/hello_robin.pbxindex
./build/hello_robin.build/hello_robin.pbxindex/categories.pbxbtree
./build/hello_robin.build/hello_robin.pbxindex/cdecls.pbxbtree
./build/hello_robin.build/hello_robin.pbxindex/decls.pbxbtree
./build/hello_robin.build/hello_robin.pbxindex/files.pbxbtree
./build/hello_robin.build/hello_robin.pbxindex/imports.pbxbtree
./build/hello_robin.build/hello_robin.pbxindex/pbxindex.header
./build/hello_robin.build/hello_robin.pbxindex/protocols.pbxbtree
./build/hello_robin.build/hello_robin.pbxindex/refs.pbxbtree
./build/hello_robin.build/hello_robin.pbxindex/strings.pbxstrings
./build/hello_robin.build/hello_robin.pbxindex/strings.pbxstrings/control
./build/hello_robin.build/hello_robin.pbxindex/strings.pbxstrings/strings
./build/hello_robin.build/hello_robin.pbxindex/subclasses.pbxbtree
./build/hello_robin.build/hello_robin.pbxindex/symbols0.pbxsymbols
./Classes
./Classes/hello_robinAppDelegate.h
./Classes/hello_robinAppDelegate.m
./Default.png
./hello_robin-Info.plist
./hello_robin.xcodeproj
./hello_robin.xcodeproj/danbri.mode1v3
./hello_robin.xcodeproj/danbri.pbxuser
./hello_robin.xcodeproj/project.pbxproj
./hello_robin_Prefix.pch
./icon.png
./main.m
./www
./www/index.html
./www/master.css

So, if you build/install this, you get a default app whose index.html
has some buttons and displays showing off various of the
cross-platform PhoneGap APIs.

What I did, very simply, was just to replace that index.html with the
test widget from your Widgeon filetree:
http://code.google.com/p/widgeon/source/browse/#svn/trunk/test-widget

(The unzipping was done by hand; the manifest file was ignored)

Unsuprisingly (since it's just a simple Web page in a .zip, it worked
fine. I even added an event handler to make the phone vibrate whenever
anyone touched the image, and that worked too.

And that's as far as I got. There is clearly scope for better workflow
integration, eg. handling of the zipping/unzipping of widgets. But
with this simplest of test cases, the result was just fine. To recap:

1. get a mac set up for iphone dev w/ xcode
2. install phonegap and addon for xcode
3. create a new phone-gap based project
4. add an unpacked widget to the generated www/ dir in the project
filetree, using index.html as the front page
4. compile/install it to iphone

The idea of this stuff also working on other mobile platforms, and
with rich and increasingly standardised APIs, is pretty exciting...

cheers,

Dan

ps. If anyone cares to buy me an Android phone I'll be happy to test
things there ;)

> [0] http://www.w3.org/2001/tag/group/track/actions/345
>
> --
> Robin Berjon - http://berjon.com/
>
>
>
>

Received on Monday, 21 December 2009 15:08:02 UTC