Creating a BlackBerry WebWorks app

Some notes on building my first WebWorks app.

I figured the quickest way to get an app up and running would be to take the examples from BlackBerry.

Working from https://github.com/blackberry/WebWorks-Samples/tree/master/UIExamples I first did a git clone, but then reading the documentation I downloaded a zip of the UI examples instead.

The documentation talks about downloading a zip, unarchiving it, shuffling things around, and rearchiving it. The first problem I came across (on a Mac) doing this was Apple’s resource forks screwing up the zip:

bbwp mac zipInvalid application archive: resource name is not valid(__MACOSX/UIExamples/._bbmBubbles.htm

Next up, another packaging problem: despite following the documentation (or so I thought), I could not get bbwp to build my package:

bbwp config not foundInvalid application archive – failed to find config.xml

bbwp zip

It turns out I was doing it wrong – the config.xml needs to be at the same level as the containing folder (http://stackoverflow.com/questions/4433092/package-my-first-blackberry-widget-xml-file-not-found). A tweak to the layout and then:

zip -r UIExamples.zip UIExamples config.xml

That fixed the packaging problem (both with missing files and with Mac resource forks). The next error I got was “Spinner not found”:

bbwp spinner

There’s quite a few extra steps you need to go through to add the UI Spinner extension, which can be summed up as:

  • download the SpinnerControl zip
  • extract the zip
  • create the /Developer/SDKs/Research In Motion/BlackBerry WebWorks SDK 2.3.0.9/ext/blackberry.ui.Spinner directory
  • copy the library.xml file into that directory
  • copy the blackberry-WebWorks-Community-APIs-4d7c20a/Smartphone/SpinnerControl/src/blackberry folder into the ext/blackberry.ui.Spinner directory.

Phew. The packaging will then work:

bbwp completeBlackBerry WebWorks application packaging complete

I think there’s some optimisation that could be done on this process. In general the WebWorks development seems to involve a lot of copying files here and there.

One thing that wasn’t clear was where the output package went. I was running

./bbwp /Users/savs/Downloads/blackberry-WebWorks-Samples-0a5693e/UIExamples.zip

… but although it declared success, I could find no output. So don’t do this. It turns out you need to add -o (picked up from Lukasz‘ excellent presentation on differences between Enyo and WebWorks):

./bbwp /Users/savs/Downloads/blackberry-WebWorks-Samples-0a5693e/UIExamples.zip -o /tmp/

This gives two folders, OTAInstall and StandardInstall, which contain a bunch of files with .cod, .jad, .cso, .csl, .alx extensions. No idea what these are – I guess I’ll find out as I continue to explore.

Now I’ve got a packaged app, what do I do now? Next up: time to try out the emulator.

~

Update: turns out I’m not quite right about the folder structure and location of config.xml – although it worked, when you deploy it on a phone it fails. Instead you have the config file at the same location as your resources, and do the zipping of the contents of the project, rather than the project folder:

zip -r UIExamples.zip *

And then package:

./bbwp /Users/savs/Downloads/blackberry-WebWorks-Samples-0a5693e/ProjectRoot/UIExamples/UIExamples.zip -o /tmp/bbwp/

… and it works on the phone as well.

This entry was posted in Mobile Tech, Planet, Research, Technology and tagged , , , . Bookmark the permalink.

2 Responses to Creating a BlackBerry WebWorks app

  1. thanks Andrew I was trying to convert our QuickBlox HTML code sample into a Blackberry build and just couldn’t figure out that error with Mac OS resource name. Had no idea you have to use command line ZIP to make through. :-) Thanks!