Rhomobile Beginner's Guide

By Abhishek Nalwaya
    Advance your knowledge in tech with a Packt subscription

  • Instant online access to over 7,500+ books and videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies
  1. What is Rhomobile?

About this book

The four Rhomobile products – Rhodes, Rhosync, RhoHub, and Rhogallery – provide a complete toolkit for creating a mobile application. Rhomobile is cross-platform and so allows you to build your application for many different types of smartphone – including iPhone and Blackberry – just with a single codebase. This makes it the most preferred and quickest way of developing mobile apps. As you create a native Rhomobile application, you can use the built-in device features such as GPS, Push, and Camera, all with offline capabilities.

Rhomobile Beginner's Guide is filled with practical examples to help you to create a mobile application from scratch. You can choose on which operating system to build, as well as for which smartphone to develop your application, giving you the freedom to create a customized mobile application quickly and easily.

Once you have learned how to install Rhomobile on Windows, Mac, or Linux, you will create a simple application, which will be used to explore the products of Rhomobile one by one. Things really get going when you write unit test cases for your application before deploying it to the server and making builds for your chosen Smartphone.

You will learn about the different aspects of Rhomobile, starting with Rhodes 3, which helps you to build a native mobile application. Rhosync 2.1 carries out the offline device capabilities and RhoHub deploys the code on the server and creates a build for the different smartphones.

Rhomobile Beginner's Guide gives you the freedom to create a mobile web application on the platform of your choice, for the smartphone of your choice.

Publication date:
July 2011


Chapter 1. What is Rhomobile?

Welcome to the Rhomobile Beginner's Guide. The goal of this book is to teach you how to create your own Mobile application from scratch using Rhomobile. We will learn how to develop a mobile application with Rhomobile by building a sample application from scratch. We will try to have something tangible with running code by the end of every chapter so that you can see a clear progression from chapter to chapter.

Though Rhomobile products are large and part of a fast-moving framework, we'll focus on the smaller, more stable, set of core Rhomobile techniques that have crystallized in the last couple of years. This means that the knowledge you gain here will not become obsolete too quickly. This book is written keeping the Zero to Deployment approach in mind.


The Rhomobile family

Mobile devices are very powerful today and are getting more dominant with time. The success behind the phenomenal growth of smart phones is the mobile application loaded in them, which increases their functionality exponentially. Mobile applications can be developed by using different frameworks and programming languages based on the type of mobile device. Different mobile devices use different hardware components, therefore, mobile software and mobile applications have to be developed using different software architectures. It is a very painful process if we have to develop applications for all of the smart phones in the market. So Rhomobile came up with the idea of developing an application with one code base and building it for all smart phones. Before learning about the Rhomobile architecture we should have an understanding of Rhomobile and its products.

Rhomobile Inc. is a computer software company that provides leading products for building the new generation of mobile applications. It offers an open-source Ruby-based mobile development framework for business mobility solutions through its four major products Rhodes, RhoSync, Rhohub, and RhoGallery.

Rhomobile has revolutionized the process of developing mobile applications. It has enabled developers to become much faster and more efficient, allowing quicker application development. It enables software programmers to build applications for mobile devices using HTML and Ruby instead of proprietary languages such as Objective-C. Currently, the Rhodes framework supports development for the iPhone, Windows Mobile, Google Android, Symbian, and BlackBerry operating systems.

Now we will learn more about the four major products of Rhomobile.


Rhodes is an open source framework by Rhomobile. It develops native applications for almost all smart phones. The applications built through Rhodes are pure native applications and use device capabilities such as GPS, PIM contacts and calendar, camera, native mapping, push, barcode, signature capture, and Bluetooth.

Rhodes accelerates the development of mobile applications without compromising on its portability. This framework is similar to the popular Rails framework. It is based on Model view Controller and has inbuilt Object Relational Manager (ORM) called Rhom that is similar to active Record in Rails. Most user interface customization can be done in HTML templates (ERB, eruby files). A single set of source written with Rhodes can be compiled to run across all of the supported smart phones. This means that we will have the same code base for all your devices.


RhoSync is a standalone mobile sync server that keeps enterprise application data up to date and available on users' smart phones. Enterprise apps require local synchronized data to be used most of the time. The information is stored locally on a users' device and is available to them even in offline mode. It is very easy to write a source adapter as RhoSync generates most of the code while creating the source adapter. The source adapter can also be used to Create, Read, Update, and Delete (CRUD) operations on a model.

Rhosync uses Redis, which is a NoSql Key Value store for data caching. This makes Rhosync more scalable. RhoSync performs its push-based sync using the native smartphone push SDKs. It uses new advanced BlackBerry Enterprise Server and iPhone 3.0 SDKs for Push. It uses BES Push and iPhone Push for synchronization, allowing real-time updates of backend application information. We will explore RhoSync and its features in detail in Chapter 5.


RhoHub is a hosted development environment for Rhodes and Rhosync. The RhoSync application will be deployed on the famous Ruby cloud Heroku with the interface of RhoHub. RhoHub enables git-powered source control and collaboration with your team. It allows us to directly build an application for different smart phones without installing SDKs.

It makes the process of the build very smooth since we don't have to install any development toolkits. It is only a one click process that automatically creates a build for most of the smart phones. We will discuss this in detail in Chapter 9.

Rhohub provides us with the following functionalities:

  • Creating a build for a Rhodes application

  • Deploying the Rhosync application to the cloud

  • Providing version control with git

  • Managing collaborators


RhoGallery provides a hosted mobile app management solution. It allows administrators to manage the set of apps exposed to their users. It also makes it easy for them to get mobile apps onto their devices. It enables users to launch all of their important enterprise apps from a single place. RhoGallery consists of a management console for "app galleries" on RhoHub, as well as a RhoGallery App that users load onto their devices. Even for an individual developer with one or a few apps, RhoGallery makes it easy to expose those apps to their users. RhoGallery handles inviting the users and determining the appropriate downloads to provide to them.

RhoGallery provides the following functionalities:

  • Administrator management of exposed apps to end users

  • Central user launching of exposed apps

  • Automatic provisioning of appropriate apps for end users


Why Rhomobile is cutting edge

The following features give a cutting edge to Rhomobile in mobile application development:

  • Model View Controller: Most of the other frameworks available in the market are based on HTML and JavaScript. However, as Rhodes is a Ruby-based framework and its structure is similar to the popular framework Rails, it also supports Model View Controller, so code written with Rhodes is more structured and easy to understand.

  • Cross Platform Support for All Devices: Rhodes supports the following devices: Android, Windows Mobile, BlackBerry, and iphone. The best thing is you have a single code base from which you can build applications for different smart phones. It does not work in a traditional way in that we have to write separate code for different types of phones.

  • Offline Capabilities using Rhosync: Rhomobile supports local synchronization of data. As we can synchronize the data using Rhosync it provides offline Capabilities. It can work even if you are offline.

  • Object Relational Manager: Rhodes provides an inbuilt Object Relational Manager called Rhom. It is similar to Active Record in Rails but with basic functionality only. It helps us to write queries without thinking about which database is being used by phone.

  • Rapid Development: One of the most interesting features of Rhodes is that it imposes some fairly serious constraints on how you structure the applications that help us for rapid development. Rhomobile products are properly structured and well organized, which enforce us to do rapid development. Rhodes is very comfortable, familiar, and massively productive.

  • Scalable Sync Server: The Sync Server uses a NoSql Database which makes it scalable. Specifically, it is the only sync server that has a built-in "no SQL" Redis key value store, making it more scalable than other sync servers which offer internal relational database servers for caching. RhoSync also performs its push-based sync using the native smart phone push SDKs, which no other sync server does.

  • Liberal use of code generation: Rhodes/RhoSync can write a lot of code for you. For example, when you need a class to represent a table in your database, you don't have to write most of the methods. Rhodes even offers an application generator that creates an initial app based on the structure of your models or business objects in your app. It's very similar to the scaffolding offered by most modern web frameworks with basic list/create/read/update/delete objects functionality. For each basic CRUD action, views in HTML are also offered. You'll find that you're writing only a fraction of code compared to other frameworks.

  • Metadata: Every enterprise application that is used to run a company's core business has a different schema for its business objects. For example, every application has a varying and customized structure that changes with time. It is not possible to install the client application again and again for a small change. The Metadata framework provides a way to handle the view from the Rhosync server. It also provides validation and a custom template. We will discuss this in detail in Chapter 8.

  • Hosted Development and Build: Rhomobile also provides a hosted management and Build through Rhohub. We can deploy a Rhosync app and build our Rhodes code for different phones with it.

Which products does Rhomobile support?

Rhomobile supports a variety of smart phone devices and tablets. Currently, Rhodes version 3 supports the following major platforms:

  • iPhone and iPad

  • Android

  • Blackberry

  • Windows Mobile including Windows mobile 7


Note: Support for Symbian is no longer available from Rhodes version 2.2.


Rhomobile architecture

One of the interesting features of Rhomobile is that it imposes some fairly serious constraints on how we structure our mobile applications. Surprisingly, these constraints make it easier to create applications—a lot easier than one may think. To understand how these constraints help us, it is essential to understand the architecture first.

The normal Rhomobile application has a 3-layer architecture:

  • Rhodes Application

  • Rhosync Server

  • Backend Application

Rhodes application

This is the application that will be installed on your smart phone. It can also work independently without using Rhosync. If you don't have any external data, you can only develop your application with Rhodes.

Rhodes applications are developed with MVC. These are true native device applications (NOT mobile web apps) that work with synchronized local data and take advantage of device capabilities such as GPS, PIM contacts and calendar, camera, native mapping, push, barcode, signature capture, and Bluetooth.

The major components of a Rhodes Application are:

  • Model View Controller: This is the heart of a Rhodes application that has the major code of your application. The model manages the behavior and data of the application domain, and responds to requests for information about its state (usually from the view), as well as to instructions to change the state. The view manages the display of information. The controller receives input and initiates a response by making calls on model objects. A controller accepts input from the user and instructs the model and viewport to perform actions based on that input.

  • Rhom: This is the mini ORM Layer provided by Rhodes that helps us to run a query on Phone Devices. It provides a high level way to make the local database easier to program. That database is SQLite on all platforms except BlackBerry, where it is HSQL. Speeding your time to market continues to be the theme at Rhomobile and including an ORM in the framework saves you time during the development phase by standardizing and simplifying the effort when writing mobile business apps once for all the popular Smartphones.

  • Ruby Virtual Machine: This is the inbuilt Executable available for Rhodes that executes the Ruby code.

  • Device API: These are APIs that help us to access device capability like GPS, PIM contacts and calendar, camera, native mapping, push, barcode, signature capture, and Bluetooth.

  • RhoSync Client: These are the codes to synchronize the data from the Rhosync server. These include code for authentication, Synchronization, Reset Database, etc.

Rhosync application

Rhosync is a Mobile sync Server that keeps enterprise application data up to date and available on users' smart phones. The information is stored locally on a user's device and available when disconnected. The RhoSync server handles the job of connecting the Rhodes application to backend applications, keeping track of multiple devices and what information they need, and sending them just those updates. RhoSync can also be used to register its interest in changing information from the backend. It then efficiently "pushes" the changes to the phones via the native Smartphone push SDKs.

RhoSync consists of the following components:

  • Synchronization Framework: The core of RhoSync; this facilitates data synchronization between the Rhodes/RhoSync-Client and a third-party source (SOAP, REST, etc.). Each source is synchronized by implementing a simple "source adapter" class. The client connects with the embedded Sinatra server to interact with the collection of source adapters.

  • REST API: The RhoSync API allows you to control, monitor, and debug a running RhoSync application using a simple HTTP API.

  • Administration Console: A Sinatra server is used for manipulating and peeking into a running RhoSync app. The console uses the RhoSync API for its functionality.

  • Asynchronous Job System: RhoSync uses the Resque library to provide asynchronous execution of various tasks that it needs to perform. These tasks include source adapter execution, sending push messages, preparing bulk data, etc. Resque is dead-simple to use and highly extensible, so it can easily be used for other functionality not described here.

Backend application

This application feeds data using REST, SOAP, or any other API to the RhoSync Server. It can also interact directly with the Rhodes application using Async HTTP calls. This is your basic legacy application that can provide data to the RhoSync Server in JSON, XML, or any other format. These are similar to web services that can be developed in any language. There are plugins that allow the Client application to fetch data directly from a Backend application. It is also possible that RhoSync can interact with multiple Backend Applications.



For a first time user many questions must be coming to your mind. Let's make you more familiar with Rhomobile with these FAQ's:

Question:Does Rhomobile create a pure Native Application?

Answer: Yes. Rhomobile creates a pure Native Application. This Application is similar to an Application available in i-store. This application can use device capabilities such as GPS, PIM contacts and calendar, camera, native mapping, push, barcode, signature capture, and Bluetooth. These are much faster than Browser-based applications.

Question: I am new to Ruby should I use Rhomobile?

Answer: Although you need to know Ruby to write Rhodes applications, we realize that many folks reading this book will be learning both Ruby and Rhomobile at the same time. As Rhomobile products require an elementary level of Ruby knowledge, this will not affect your learning curve. But I recommend that you go to any Ruby tutorial online.

Question: Is Rhomobile Free?

Answer: Rhodes is free and open source under MIT Licence. To use RhoSync, you must purchase a commercial license when development commences or you must open source your app under the GPL license. The pricing and details can be found at www.rhomobile.com.

Question: Is support available for Rhomobile?

Answer: Yes. However, you have to purchase a Rhodes Enterprise License and the Rhodes Commercial License to get commercial support. Apart from the Rhomobile support, there are various webinars and tutorials available on www.rhomobile.com. Another good support resource is the Rhomobile Google group, where Rhomobile experts are there to help you.

Question: What about Rhomobile security?

Answer: Both Rhodes and RhoSync support use of https as a transport. In fact it is easier with Rhodes than with native code. You just list the https URL and Rhodes will connect to the backend appropriately. This is simple in contrast to underlying SDKs where significantly different code is written to connect to an https URL.

Question: Does Rhomobile support HTML5?

Answers: Yes, Rhomobile supports HTML5 tags provided the device you are targeting also supports them.

Question: Can we write unit test case for the code?

Answers: Yes, we can write unit test case in Rhodes, which will be shown in Chapter 7.

Question: Can we use Ruby gems with Rhodes?

Answers: Yes, we can use Ruby gems with Rhodes. We have to include them in the Rhodes configuration file. We will discuss this in later chapters.

Question: Do we need to have knowledge of different device databases?

Answer: No, we don't need to have prior knowledge of those databases, Rhodes will take care of this. We write our query using Object-relational mapping (ORM) called Rhom and it is the work of ORM to shape the query.



Now we have understood Rhomobile and its architecture. Following are the topics we have covered:

  • What is a mobile app

  • What is Rhomobile Inc. and its products

  • What is the difference between Rhomobile and other products in the market

  • What is the architecture of Rhomobile

In the next chapter, we will learn to install and configure various Rhomobile products on different platforms such as Windows, Mac, and Linux.

About the Author

  • Abhishek Nalwaya

    Abhishek Nalwaya is the author of the book, Rhomobile Beginner's Guide. He is a Ruby enthusiast and loves to participate regularly at Ruby and Ruby on Rails meetup groups. He works for a Management Consulting firm. He has spoken at many conferences, meetups, and was the speaker at RubyConf India 2012 and RubyMotion Conference 2013.

    Browse publications by this author
Rhomobile Beginner's Guide
Unlock this book and the full library for FREE
Start free trial