This is

as days pass by, by Stuart Langridge

. Here I write about many things. In the past I wrote about other things but the past is past. I write code for people to play with, I write about my life on Twitter, and I write here.

On I wrote Making phone apps, on the subject of CouchDB, Ubuntu One, HTML5, and mobile.

This is more a memo to myself than anything else.

I want an app on my phone that displays my Ubuntu One stuff; notes, files, contacts, that sort of thing.

I do not want to have to write it in Java. Nor do I want to have to port it to Objective-C so iPhone people can have it. I want to write an HTML5 app, because then it works everywhere, there's only one codebase, and (critically) I can do it.

Data in Ubuntu One is stored in CouchDB (well, files aren't, but let's leave files out of this for now; they'll work a similar way). CouchDB is all HTTP. So it should be possible to write an HTML5 app that retrieves my data from CouchDB.

Problem 1: an HTML5 app can't access CouchDB on another server, because JavaScript can't request data from another server.

Solution 1: Cross Origin Request Sharing, a W3C spec. Implemented by Firefox 3.5 and by the WebKit in my Nexus One, at least.

I want my app to work offline, of course. I shouldn't have to be online to read my notes.

Problem 2: web apps don't work offline, they're web apps.

Solution 2: use a manifest. Checklist, an HTML5 app, does this beautifully.

But how does the phone store data offline? That's not even worthy of a "problem" statement; offline HTML5 storage has been available for ages.

How does one authenticate to Ubuntu One to get the right data? Well, we use OAuth, deliberately because it enables this sort of thing. So that's all doable, too.

It feels rather like all these different puzzle pieces are slotting together. And that I have another project to write. Game on.

Elliot

I'm in.

Joshua Blount

I'll help out but only if you get your blog to properly display a title element :)

Mattias Holmlund

Run couchdb and desktopcouch on your phone and sync it with ubuntu one.

See http://thomas.apestaart.org/log/?p=1106 for setting it up on Nokia N900.

sil

goldarnit, title element. I'll sort that :)

Mattias: that's cool for the N900; it's quite a bit harder for Android or iPhone, though, because it'd require native ports of erlang to those devices, which is doom. The whole idea of using an HTML5 app is that it would avoid individual builds for individual platforms.

gabriele

excuse me, but i saw ASE on android which lets you run python, vala, etc... on android

can't you use that ?

sil

gabriele: ASE doesn't let you write an app that someone can easily install. Instead, they'd have to download ASE, then download the Python interpreter, then download my app as a script and copy it to the SD card, then run the script -- and scripts have no way of producing UI. Also, ASE would only give me Android support for apps.

benoitc

i'm thinking on such things too. Did you find an easy way to handle media (photo, video, ..) upload offline ? Handling text is easy using sqlite in browser of k/v offline storage, but I don't have easy solution yet. Did you find any hack around it ?

sil

Hm, offline file uploads. Can't think of a good way of doing that. I don't think it's possible to capture a file upload with JS, is it?

Gonzo

What about the FileAPI (http://www.w3.org/TR/FileAPI/)? It's supported in Firefox and Chrome 6, don't know about mobile browsers.

This website belongs to Stuart Langridge. Contact details are available. Don't eat yellow snow. Valid HTML5, at least in theory, except for the bits that aren't because I'm that futuristic that I'm ahead of the spec, oh yes. HTML5 help from Bruce Lawson, among others. Fonts from the superb FontSquirrel. End.