Sunday, January 12, 2014

Running Nibiru Mobile on iOS

For those who doesn't know about Nibiru Mobile (the 99.99% of the people reading this, I guess, hehe), I'll  transcribe the introduction from Google Code page:

Nibiru Mobile is a framework for developing portable mobile applications created at Oxen.
You can use it in order to create portable HTML-based (GWT) application and/or native Android applications reusing most of the code.

In short, the framework defines a common Java API for building mobile apps. Writing for this API, you can develop native Android apps and HTML apps for other platforms (iOS, Windows Phone, BlackBerry, etc) using GWT+PhoneGap. The only native platform supported is Android.

Some time ago we read about RoboVM, which allows compiling from Java bytecode to native iOS using LLVM. It also includes a Java bridge for some Cocoa APIs. We though that using it to create a native Nibiru Mobile implementation would be cool, so we started a proof-of-concept (still in progress).

There where some Nibiru Mobile component implementations that were currently used only in the Android platform. Since these components weren't compatible with GWT, they where placed in the project. Now, some of these implementations could be reused on iOS platform, so we created a new project ( and moved them to it.

Amazingly, many of these Java stuff worked ok on iOS using RoboVM. This is impressive, since RoboVM is in an early development stage (0.0.7 version at time of writing this post). Some Java implementations that worked using RoboVM include:

  • Dependency injection using Guice (in fact, there where an error with version 0.0.6 that was fixed on 0.0.7)
  • i18n message internationalization using ResourceBundle + dynamic proxies.
  • JSON serialization using Jackson.
We're still working on
  • HTTP handling using Apache HTTP Client.
  • Event subscribing/publishing using Guava EventBus.
Regarding native implementations, we wrote implementations for MVP interfaces using Cocoa classes. Place management, adapters for widgets, etc. There is still a lot of work to do in this area.

Another pending issue is implementing persistence. Probably we'll implement DAOs using Core Data.

At the moment of writing this, the POC can be found on iOS branch on Google Code. It is being developed on 0.3-SNAPSHOT Nibiru Mobile version.

Any idea/suggestion is welcome!