Book Image

Rhomobile Beginner's Guide

By : Abhishek Nalwaya
Book Image

Rhomobile Beginner's Guide

By: Abhishek Nalwaya

Overview of 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.
Table of Contents (17 chapters)
Rhomobile Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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.