Rhomobile 1.2 for iPhone, android, blackberry, win mobile

We’ve been evaluating the Rhodes platform, aka Rhomobile, as a way to deliver multiplatform applications to our customers. Version 1.2.1 was recently released.

One thing that is clear right away is the development platform problem. Develop on OSX if you need to work on iPhone and Android ports. Use Windows if you plan to release for Android, Windows Mobile, and Blackberry. For most multiplatform deployment combinations you’ll need to switch back and forth, use windows in a vm, etc.

Back on OSX, install rhodes and create a basic application. The application will work only with local data and not synchronize it with a server copy. (You need to install the iPhone SDK and ruby/rubygems as prerequisites).

$ sudo gem install rhodes
$ rhogen app testapp
$ cd testapp
$ rhogen model location lat,lon,rating,image_path,type

To use the scaffolds for model manipulation, we’ll add the model controller to the main index:

$ cat app/index.erb


<div>
<h1 id="pageTitle">
Testapp</h1>
</div>
<ul id="home" title="Testapp">
<li><a href="Location">Locations</a></li>
</ul>

We should be able to run the application using “rake run:iphone:app” but I’ve seen the results from this to be inconsistent–in some cases it runs ok, in others the application crashes shortly after launch inside the simulator. I’ll show you how to build the iPhone harness from source and execute the app from there. This also results in a version that can execute inside iPhone OS3. You’ll want to use this to submit the application to the store anyway.

$ git clone git://github.com/rhomobile/rhodes.git
$ cd rhodes
$ cat rhobuild.yml

env:
  app: /Users/bmidgley/testapp
  version: 1.2.1
  vendor: rhomobile
  applog: rholog.txt
  paths:
    java: /usr/bin
    android: /Users/bmidgley/android
  build:
    androidpath: platform/android
    iphonepath: platform/iphone

Launch Xcode, select File->Open project, choose rhodes/platform/iphone/rhorunner.xcodeproj, and run Build->Build and Debug. The application appears and you can navigate into Locations to add/edit/delete location records.

What do you notice right away in this application?

  • The iPhone button bar is dedicated almost entirely to navigating the web view as if it were a web page
  • The normal iPhone navigation controller back button does not appear in the main bar. The “browser” back button does what you expect in most cases but in a nonstandard place.
  • The browser back button and the navigation bar back button will inevitably behave differently (create an object, then immediately click back once and see if you end up where you expect to)
  • There is a special tab bar area to set your credentials. The home button will get you back to the main app.
  • Choose “name” as the first column for your model so you’ll have a reasonable display of the list of items.
  • The other columns are all treated as strings and appear without any special concerns over validation or meaning

In version 1.4 of rhomobile, we should be able to replace the rhodes tab bar with a custom bar. The code will be multiplatform and will affect the menu results you get on Android and the other platforms appropriately. This API is implemented for blackberry and can be previewed at the wiki.

I’ll revisit rhomobile next week and explore it more.

Picture 1
Picture 3
Picture 4