Building a Smartphone (Android, iPhone, BlackBerry etc) app using ruby
Rhodes is an open source framework to rapidly build NATIVE apps for all major smartphone operating systems (iPhone, Windows Mobile, RIM, Symbian and Android). These are true native device applications (NOT mobile web apps) which work with synchronized local data and take advantage of device capabilities such as GPS, PIM contacts and camera.
Yeah! Its in Ruby 🙂
- support for ALL smartphones
- synchronized offline data
- a Model View Controller (MVC) framework
- an Object Relational Manager (ORM) to avoid direct SQL coding
- the mobile Ruby
- a hosted development service
- scaffolding to quickly build the app
- gem install rhodes
- Java JDK latest version is needed for Android. Make sure its installed. Test by typing $javac -version in your terminal
- Download Android SDK (for linux, Mac OS, Windows) and extract at a convenient location.
- Change in your ~/.bash_profile(Mac) and ~/.bashrc(Linux) to add
export PATH=/path-to-android/tools:$PATHexport ANDROID_HOME=/path-to-android
- typing $android in the terminal shall start Android SDK and AVD Manager
- once ACD manager started install the latest packages under “Available packages”, it will take a while to install
- Once installed they will list under “Installed Packages”
- else installation follow these instructions to install Android SDK starter packages, and change the PATH environment variable for sure
- Download and install Android NDK (Win, Mac OS, Linux) and export your path same as above
rhogen app HelloWorld
rake -T (will list all the rake tasks for all supported smartphones)
rake run:android (it will build, install and launch the HelloWorld Program)
Of course it will be blank and its just the start. Go to launcher you will be able to see your HelloWorld application with rhodes default icon.
This is fine, but what about ruby and MVC framework? Open your latest HelloWorld in your favorite editor(textmate etc). You will find an “app”, “app=>helpers” folder much like rails “rhoconfig.txt” => configuration settings
$ rhogen model Contact name, email, phone
Generating with model generator:
You can see the controller, model and view files similar to Rails frame work.
start_path = ‘/app/Contact’ (in rhoconfig.txt)
$ rake run:android
Your application will relaunch and you can click “new” button to add new contacts and edit and delete them. So basic CRUD functionality is available much like rails and ready to go.
I hope you will find this ready to go tutorial very helpful to start of your application on any smartphone using Rhodes framework.
Stay tuned for more!