ebook img

Rhodes Framework for Android™ Platform and BlackBerry® Smartphones PDF

55 Pages·2012·7.963 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Rhodes Framework for Android™ Platform and BlackBerry® Smartphones

SpringerBriefs in Computer Science Series Editors Stan Zdonik Peng Ning Shashi Shekhar Jonathan Katz Xindong Wu Lakhmi C. Jain David Padua Xuemin Shen Borko Furht V. S. Subrahmanian For furthervolumes: http://www.springer.com/series/10028 Deepak Vohra Rhodes Framework TM for Android Platform (cid:2) and BlackBerry Smartphones 123 Deepak Vohra e-mail: [email protected] ISSN 2191-5768 e-ISSN2191-5776 ISBN 978-1-4614-3578-5 e-ISBN978-1-4614-3579-2 DOI 10.1007/978-1-4614-3579-2 SpringerNewYorkHeidelbergDordrechtLondon LibraryofCongressControlNumber:2012934252 Thisbookisanindependentpublicationandisnotaffiliatedwith,norhasitbeenauthorized,sponsored, orotherwiseapprovedbyGoogleorResearchinMotion,and/oranyoftheirsubsidiaries. References to variousGoogle or Researchin Motioncopyrightedtrademarks, characters, marks and registeredmarksownedbyGoogleorResearchinMotionand/oranyofitssubsidiariesmayappearin thisbook.Ratherthanuseatrademarksymbolwitheveryoccurrenceofatrademarkedname,logo,or image we use the names, logos, and images only in an editorial fashion with no intention of infringementofthetrademark. (cid:3)TheAuthor(s)2012 Thisworkissubjecttocopyright.AllrightsarereservedbythePublisher,whetherthewholeorpartof the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,broadcasting,reproductiononmicrofilmsorinanyotherphysicalway,andtransmissionor informationstorageandretrieval,electronicadaptation,computersoftware,orbysimilarordissimilar methodology now known or hereafter developed. Exempted from this legal reservation are brief excerpts in connection with reviews or scholarly analysis or material supplied specifically for the purposeofbeingenteredandexecutedonacomputersystem,forexclusiveusebythepurchaserofthe work. Duplication of this publication or parts thereof is permitted only under the provisions of theCopyrightLawofthePublisher’slocation,initscurrentversion,andpermissionforusemustalways beobtainedfromSpringer.PermissionsforusemaybeobtainedthroughRightsLinkattheCopyright ClearanceCenter.ViolationsareliabletoprosecutionundertherespectiveCopyrightLaw. The use of general descriptive names, registered names, trademarks, service marks, etc. in this publicationdoesnotimply,evenintheabsenceofaspecificstatement,thatsuchnamesareexempt fromtherelevantprotectivelawsandregulationsandthereforefreeforgeneraluse. While the advice and information in this book are believed to be true and accurate at the date of publication,neithertheauthorsnortheeditorsnorthepublishercanacceptanylegalresponsibilityfor anyerrorsoromissionsthatmaybemade.Thepublishermakesnowarranty,expressorimplied,with respecttothematerialcontainedherein. Printedonacid-freepaper SpringerispartofSpringerScience+BusinessMedia(www.springer.com) Preface Rhodesisanopensource,Ruby-based,lightweight,MVC(modelviewcontroller) framework, optimized for mobile devices, which have memory limitations. The Rhodesframeworkoffersseveraladvantagesoverothermobileframeworks.Some of the unique features of the Rhodes frameworks are as follows. • TheonlysmartphoneframeworktooffersupportfortheModelViewController pattern. • The only smartphone framework to offer support for the Object-Relational manager. • The only smartphone framework to offer offline, disconnected access to data with the RhoSynch server. • The only smartphone framework to support all mobile devices including AndroidTM platform smartphone, BlackBerry(cid:2) smartphone, iPhone(cid:2), Symbian Platform, and Windows Mobile(cid:2) operating system. • Provides Ruby implementations for all smartphone device operating systems. • Provides a web-based Integrated Development Environment for developing mobileapplicationsforallsmartphoneplatformswiththeRhoHubdevelopment service. Google’s AndroidTM platform and RIM’s BlackBerry(cid:2) smartphone are the top two most commonly used smartphone platforms. AndroidTM platform has more than 40% of the smartphone market share. In Chap. 1 we discuss the AndroidTM platform. In Chap. 2 we discuss the Rhodes framework with the BlackBerry(cid:2) smartphone. We develop the same Rhodes applications for AndroidTM platform andBlackBerry(cid:2)smartphone;oneapplicationforacatalogandanotherforanRSS feed. v Contents 1 Rhodes on AndroidTM Platform . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Installing the Android SDK . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.3 Installing Ruby . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.4 Installing Rhodes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.5 Creating a Rhodes Application . . . . . . . . . . . . . . . . . . . . . . . . 4 1.6 Creating a Rhodes Model for a Catalog. . . . . . . . . . . . . . . . . . 9 1.7 Creating a Rhodes Model to Get RSS Feed . . . . . . . . . . . . . . . 13 2 Rhodes on BlackBerry(cid:2) Smartphones. . . . . . . . . . . . . . . . . . . . . . 23 2.1 The ReXML Parser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 2.2 Installing the BlackBerry JDE. . . . . . . . . . . . . . . . . . . . . . . . . 23 2.3 Installing Rhodes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 2.4 Creating a Rhodes Application . . . . . . . . . . . . . . . . . . . . . . . . 26 2.5 Creating a Rhodes Model for a Catalog. . . . . . . . . . . . . . . . . . 33 2.6 Creating a Rhodes Model to get RSS Feed. . . . . . . . . . . . . . . . 34 vii Chapter 1 Rhodes on AndroidTM Platform Smartphones have proliferated in recent years creating a need for smartphone apps. AndroidTM is the most commonly used smartphone platform. Ruby is an open source, dynamic, interpreted programming language. Rhodes is the only framework for mobile devices that supports MVC architecture, and provides an Object Relational Manager. Inthis chapter we shall, first,introduce using Rhodes onAndroid,andsubsequentlydevelopaRhodesapplicationtogetRSSfeedfora magazine on Android. To parse XML Rhodes includes the RhoXML parser and support for the ReXML parser may be added. 1.1 Overview This chapter which discusses the procedure to create a Rhodes applications for Android has the following sections. • Installing the Android SDK • Installing Ruby • Installing Rhodes • Creating a Rhodes Application • Creating a Rhodes Model for a Catalog • Creating a Rhodes Model to get RSS Feed 1.2 Installing the Android SDK Download the Android SDK installer_r12-windows.exe from http:// developer.android.com/sdk/index.html. Double-click on the .exe file. The AndroidSDKToolsSetupWizardgetsstarted.ClickonNext.AndroidSDKrequires Java SE Development Kit (JDK). Download and install the JDK, if not already D.Vohra,RhodesFrameworkforAndroidTMPlatformandBlackBerry(cid:2)Smartphones, 1 SpringerBriefsinComputerScience,DOI:10.1007/978-1-4614-3579-2_1, (cid:3)TheAuthor(s)2012 2 1 RhodesonAndroidTMPlatform Fig.1.1 SpecifyingtheinstalllocationforAndroidSDK installed, from http://www.oracle.com/technetwork/java/javase/downloads/index. html.InstalltheJDKinadirectorywithoutspacesinthedirectorypath.TheAndroid SDKToolsSetupwizarddetectsiftheJDKisinstalledornotanddisplaysamessage if the JDK is required to be installed. Click on Next. In Choose Install Location specifytheDestinationFolder.InstallAndroidSDKinadirectorywithoutspacesin the directory path; for example not in the C:/Program Files/ sub-directory. SpecifyDestinationFolderasC\Android\android-sdkasshowninFig. 1.1. ClickonNext.ClickonInstall. Download Android NDK zip file from http://developer.android.com/sdk/ndk/ index.htmland extract ittoa directory withoutspacesin the directory path. Create environmentvariablesANDROID_HOMEfortheAndroidSDKandANDROID_NDK_ ROOT for the Android NDK. Add ANDROID_HOME/tools, JDK_HOME and JDK_HOME/bin to the PATH environment variable. In a later section we shall configureaRhodesapplicationtobeusedwiththeAndroidemulator. 1.3 Installing Ruby Download the rubyinstaller-1.9.2-p180.exe application from http:// rubyinstaller.org/.Double-clickonthe.exefiletoinstallRuby.InstallRubyina directory without spaces in the directory path as shown in Fig. 1.2. Select the checkbox ‘‘Add Ruby executables to your PATH’’. Click on Install. 1.3 InstallingRuby 3 Fig.1.2 InstallingRubyInstaller Next,installtheRubyInstallerDevelopmentKit(DevKit),whichmakesiteasy to build native Ruby extensions. Download the DevKit-tdm-32-4.5.1- 20101214-1400-sfx.exe application from http://rubyinstaller.org/ downloads/. Double-click on the .exe file and install the self-extracting execu- tablesinadirectorywithoutspaces,suchasC:/Ruby192/DevKit.Cd(change directory) to the DevKit directory and run the following commands: The output from running the commands is shown in Fig. 1.3. The init command creates a config.xml file, which lists the RubyInstaller installed Rubies. Install RubyGems, a Ruby packaging system. Download the RubyGems zip file and extract the zip file to a directory, Cd to the directory and run the following command: Wealsoneedtoinstallgnuwin32,whichprovideswin32portsofGNUtools, GNU being a UNIX-like operating system. Download the GetGnuWin32- 0.6.3.exe application from http://sourceforge.net/projects/getgnuwin32/files/ 4 1 RhodesonAndroidTMPlatform Fig.1.3 InstallingRubyInstallerDevKit getgnuwin32/0.6.30/GetGnuWin32-0.6.3.exe/download and double-click on the.exe file. Install in a folder (C:/Ruby192 for example). Cd to the installed folder (C:/Ruby192/GetGnuWin32) and run the download command. Subsequently, run the install command: Add C:/gnuwin32/bin to the PATH environment variable. Next, install Rake, a Ruby build program, with the following command: 1.4 Installing Rhodes Rhodes is a Ruby gem that is installed just like any other Ruby gem. To install Rhodes run the following command: Rhodes 2.3.2 and related gems get installed as shown in Fig. 1.4. In the next section we shall create a Rhodes application. 1.5 Creating a Rhodes Application Rhodes provides an application generator to generate an application. The Rhodes application generator is called ‘rhodes’ and is run with the following command format: 1.5 CreatingaRhodesApplication 5 Fig.1.4 InstallingRhodes Fig.1.5 RunningtheRhodes-setupbatchscript Beforewe may runthe rhodescommand we need tosetup Rhodes using the rhodes-setupcommand.SelectEnterforeachofthequestions.TheJDKpath shouldnotincludeanyspacesinthedirectorypath.TheAndroidSDKpathandNDK pathshouldalsonotincludespacesinthedirectorypath.CdtotheC:\Ruby192 folderandruntherhodes-setupcommandasshowninFig. 1.5. Modify the C:\Ruby192\lib\ruby\gems\1.9.1\gems\rhodes- 2.3.2\rhobuild.ymlconfigurationfile,listedbelow,toincludetheAndroid paths. The JDK and Android paths are shown in bold.

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.