Cross-Platform Mobile Application Development

0 downloads 0 Views 490KB Size Report
Apr 1, 2012 - tools and Software Development Kits (SDKs) are available to develop these applications. ..... The Adobe tools required for development are available for free and can be integrated to an open ..... Barcode Reader API yes. No.
Cross-Platform Mobile Application Development

Anirudh Nagesh, MS Student School of Information Studies, Syracuse University [email protected]

Carlos E. Caicedo, Assistant Professor School of Information Studies, Syracuse University [email protected]

Abstract: Mobile applications for smartphones and other devices are having a widespread impact in many sectors of society. Mobile applications can be broadly classified into three categories namely native, mobile-web and Hybrid applications. A wide range of tools and Software Development Kits (SDKs) are available to develop these applications allow the development of cross-platform applications in which the developed code can run with little or no change in more than one mobile OS. In native mobile application development, programming languages such as Java (for Android) or Objective C (for iOS) have to be used to develop both the user interface and logic for the applications. Cross-platform application development involves using HTML5, JavaScript and open source libraries such as jQuery or jQtouch. Thus, web designers and developers can use a great part of their skills to develop mobile applications. In this report we discuss the features, differences and capabilities of various cross-platform mobile application. 1

Introduction:

As of 2011, 90% of the mobile phones shipped had touch screen capabilities and that figure is expected to reach 100% very soon close to 1 million. The continuous appearance of new applications is affected in part by the changing behaviors of users who are moving towards the mobile internet and away from the desktop for tasks such as social networking, online gaming and the sending/receiving of email. By 2014, mobile internet usage is expected to outgrow desktop internet usage [12]. Application growth is also driven by the rise of new methods and tools to develop them. The remainder of this section will describe some of the basic technologies and concepts related to cross-platform development of mobile applications. 1.1 Native vs. Cross-platform: Native applications are those which are developed using mobile software development kits (SDK), tools and languages that are native to a particular mobile OS. For example, the development of Android applications is commonly done by using the Android SDK, Java and an integrated development environment (IDE) tool such as Eclipse. iOS applications are developed using the iOS SDK, X-code and Objective C. Blackberry applications can be developed using the Blackberry SDK, J2ME and Eclipse. The final deliverable in each case will be either an .apk (Android), .ipa (iOS) or .jar (Blackberry) application file. Once developed, an application can be uploaded to an application store (Android Market, Apple Store or Blackberry application World) for widespread use. Mobile-web applications are those which use an instance of a mobile web browser to run the application. These are suited for mobile websites like m.facebook.com, m.yahoo.com, m.cricinfo.com etc. These applications are developed using cross-platform , etc. The user interface (UI) is developed in HTML5 and JavaScript and the logic is defined by JavaScript. The final deliverable is a set of files that can be hosted on a web server and the application can be accessed using an instance of a web browser. Hybrid mobile applications are a combination of the previous two application types. These applications are developed using open source libraries but also have access to some of the native capabilities of a device such as Camera, GPS, Accelerometer, File System etc. The degree of access to device features is not comparable to that of native mobile applications but it is better than ITERA 2012, The 10th Annual Conference on Telecommunications and Information Technology, 30th March-1 April 2012, Indianapolis Indiana

that o and will be described later. The UI is developed using either HTML5 or JavaScript and the logic is defined by JavaScript. These tools usually convert a mobile-web app into a native application. The following table gives an overall comparison between the three possible types of mobile applications. Type of Application/ Features

Native mobile Apps

Mobile-Web Apps

Hybrid Apps

Programming Language

Java(Android), Objective C(iOS), J2ME(BB)

HTML5 and JavaScript

HTML5 and JavaScript

Executable

Binary (.apk,. ip,. jar)

HTML + JavaScript

Binary

Distribution

Appstore, Market

Hosted on hyperlink

Execution of Apps

Directly by Operating System

By Web browser

API Usage/Access

Full Access to operating system

Device Access

Full Access

Limited Access

Full Access

Speed of Apps

Very fast

Medium

Very fast

Development Cost

Expensive

Reasonable

Reasonable

Approval Process

Mandatory

None

Low overhead

jQuery, jQtouch, Sencha

Titanium, PhoneGap, Rho Mobile

Android,

iOS,

BB,

Symbian,

a

web

server,

Either appstore hyperlink

or

By operating system, web portions executed by browser Limited

access

to

OS

1.2 HTML5 and CSS: HTML 5 is a structured language used to deliver content in World Wide Web. HTML5 is the newest version of the HTML standard which is now widely used to handle most of the content in the World Wide Web. It is not only supported by the normal desktop browsers such as Chrome, Firefox, Internet Explorer, Safari , but also the browsers included in many mobile platforms. s canvas elements, timed media playback, offline storage database, drag and drop, cross-document messaging, browser history management, MIME type support and Micro data. The leading mobile platforms iOS, Android, Windows, Palm OS, and RIM provide HTML5 capable browsers. Hence HTML5 plays a major role in helping developers write mobile applications to multiple devices at once. The cross-platform nature of HTML5 and the fact that it is supported on most of the smart phone browsers make it easy for web developers to use their existing HTML and JavaScript knowledge in developing mobile- web applications. 1.3 CSS (Cascading Style Sheet): Cascading style sheet is a language used to format the look and feel of a document written in a markup language. The markup language can be HTML, XML, XHTML and SVG. With CSS, the actual content of web pages is separated from definition of how it should be presented. The fonts, font size, color schemes, layouts are included in a CSS command file (stylesheet) and applied to the web pages. This improves the flexibility and the ease with which the web pages are developed. A CSS file is very simple and consists of many English keywords to specify the graphical definitions of the presentation styles for the elements in an HTML generated web page. CSS styles can be applied to all or part of a web page. . An example of a simple CSS would be as follows. h1 { color: white; background-color: orange} The above line of code applies a particular style to the text with heading h1. The color of the text is white and background color of the highlighted text is orange.

ITERA 2012, The 10th Annual Conference on Telecommunications and Information Technology, 30th March-1 April 2012, Indianapolis Indiana

A CSS style file (style.css) can be made to affect the presentation of a web-page by incorporating the following call in the HTML file of the web-page: http://www.abc.com/css/style.css The above line of code in the HTML page links the CSS file to the HTML page. The style sheet can be either a local CSS file or a file stored in an external server. Other ways of applying CSS is to embed the style definitions inside the HTML code of a web page. CSS3 is the latest version of CSS where style definitions are defined in the form of blocks. The segmentation of rules in blocks helps the browser define and approve the rules more quickly than doing it in one single block. This improves the performance of web page rendering.

2

Cross-

several m Mobile, there are some interesting and innovative crossdevices at a time. -web, hybrid and native applications. This reduces a lot of the effort, time and resources required to develop applications for multiple platforms. The following sub-sections describe some of the most widely used crossdevelop such applications. A detailed process has been followed in this research to find out the advantages and disadvantages of which was based on the following tasks: Determine, explore and download the development. Set up the required development environment for each framework such as necessary web servers, databases and debugging tools. Write simple example applications Compile, debug and run the applications on an emulator and also on a smartphone device. Compare the example applications across all frameworks. 2.1 Rho Mobile: RhoMobile [1] was founded in 2008 in Silicon Valley and was acquired by Motorola Solutions in late 2011. It produces an open source cross-platform SDK under an MIT license. Rho Mobile is based on Rhodes framework and is used to build native mobile applications. When developing an application controllers (logic) are written in Ruby. The platforms supported are Blackberry, Windows Mobile, Android, iPhone and iPad. Embedded RuBy (ERB) templates, HTML5, CSS and JavaScript are the programming languages used in this SDK. Some of the main characteristics of RhoMobile are: Flexible app development: The Rhodes framework allows developers to write applications based on a model-view-controller (MVC) framework. It helps the developer separate business logic in a Controller from Interface design and appearance in a View. This improves maintainability and deployment of a mobile application. App Generator: It helps create an initial application based on the structure of the models and business logic of the application. Object Relational Manager: Databases are an integral part of most of the mobile applications. Data can be stored either internally in local databases, the file system or in external databases. Rhodes provides a wrapper which simplifies the repositories. Synchronization: Enterprise applications which use email or any SAP based services require to be synced with backend databases and applications. Rhodes provides a built in mobile-sync-server which connects to the back end applications directly and even supports push-based sync capabilities. Cloud based application development: Rhodes provides a cloud based application development framework called RhoHub ls required for developing apps are hosted on the cloud server and applications can be compiled and executed for any operating system (iOS, Android, BB). ITERA 2012, The 10th Annual Conference on Telecommunications and Information Technology, 30th March-1 April 2012, Indianapolis Indiana

More information on Rhodes can be found in: http://docs.rhomobile.com/. Building a simple application in Rhodes and corresponding tutorial can be found in: http://docs.rhomobile.com/rhodes/tutorial 2.2 Phone Gap: Phone Gap [2] is a cross-platform mobile application development framework which through the use of HTML5,CSS and JavaScript allows for the development of applications for iOS, Android, Blackberry, Symbian, Windows , WebOS, Bada and Palm devices. It is based on open web-standards which means that the application can be run and tested on common web browsers such as Chrome and Safari. The application creation process is very similar to that of web pages creation, except for the installation and deployment stages. The user interface in a PhoneGap application is rendered with HTML5 and the logic is built with Javascript. Phone Gap also provides facility to use local storage such as cookies for session maintenance, Web SQL database access, HTML5 local storage and indexed storage. Additionally, Phone Gap provides access to the following device functionalities. Accelerometer Device Motion Sensor Geolocation- GPS Sensor Compass Camera, Capture audio, video and image capture capabilities Media- Allows record and playback of Audio Contacts Database File System Connection Type Device Information Some of the core events that are supported by Phone Gap are DeviceReady Pause and Resume Online and Offline Menu Button Search Button Start call Button and End call Button Volumedownbutton and Volumeupbutton Phone Gap applications can also communicate with the remote web servers. The servers can be public (twitter, facebook) or any CRM based back end application. The services accessed can be RESTful or SOAP based with requests and responses in the form of XML or JSON. 2.3 AIRPLAY SDK: AirPlay SDK [3] was founded in 1998.The Airplay SDK (Marmalade) is a licensed SDK which offers solutions for crossSymbian, Windows, WebOS and Bada (Samsung). The programming language used is C/C++ and has access to all standard libraries and language features. The executable is a single binary file with native CPU instructions that runs identically across all platforms. The IDEs supported are Microsoft Visual C++ and Xcode with support of X86 compilers both on Windows and Mac. It is mostly used for cross-platform game application development since the SDK has rich support for Open GL ES 2.0 which is suitable for rich 2D and 3D applications. Some of the features and advantages of this SDK are: Native binary without any VM Good packaging tools for many mobile OSs. Speedy software rendering engine and fallback mechanism when no hardware graphics acceleration is available Support for open source libraries. Highly optimized compression of assets for games. Debugging support with an ARM debugger on windows. Tight integration with Visual Studio which is one The SDK can be downloaded (free trial and licensed) at this link. http://www.madewithmarmalade.com/ ITERA 2012, The 10th Annual Conference on Telecommunications and Information Technology, 30th March-1 April 2012, Indianapolis Indiana

2.4 Adobe AIR: Adobe AIR (Adobe Integrated Runtime) [4] was released in December 2009 by Adobe Systems for building rich internet based mobile and desktop applications. It is a cross-platform run time environment and SDK available for developing applications for iOS, Android and Blackberry devices. HMTL5, JavaScript, Adobe Action Script, and MXML (Flex) are the languages supported. The Adobe tools required for development are available for free and can be integrated to an open source IDE like Eclipse or to lable as plug-in to Eclipse and also as a standalone toolkit. Adobe Air internally uses a Flash player as the run time environment and flash applications must specifically be built for the Adobe Air runtime in order to utilize the additional features provided such as file system integration, native client extensions, native window screen/task bar integration, Accelerometer etc. It also has built in support for SQLlite, database access via web services and encrypted local storage. Some of the key features and capabilities of Adobe Air are: Touch Input: Adobe AIR supports identifying both single touch and multi touch inputs. Text Input: Soft key board for the text input is in built in the SDK and gets automatically enabled when the text input receives the focus. orientation of the device respectively. capability of the target platform. Images: AIR has CameraUI and CameraRoll classes to access the camera functionality and image gallery of the device. It also allows access o audio and video playback capabilities of the device. 2.5 Titanium [5] was released in December 2008 by Appcelerator Inc. It is a cross-platform SDK that can deliver native applications for iOS and Android and has beta support for Blackberry. JavaScript is the main language used to write mobile applications with the support of HTML5 and CSS. It is an open source SDK which converts the Javascript code to native code (Objective C or Java) during runtime. Applications written with Titanium will have same look and feel as if the applications are written natively. The entire SDK is open source, but there are some licensed modules which can be bought. The IDE used to write Titanium applications is Titanium Studio which is shipped with the SDK. The IDE has an inbuilt JavaScript (JS) compiler which checks for dependencies, analyzes and optimizes code. Then the platform compiler compiles the JS code to native code (Objective C for iOS and Java for Android).

where JSON-style properties can be added for an object or an application. Other characteristics of Titanium are: Support for standard web based technologies like HTML, CSS, JavaScript for both desktop and mobile applications. Integrated support for AJAX like frameworks like jQuery and Yahoo UI Library. accelerometer, dialog boxes, network, database etc. APIs. For example, Ti.network.Httpclient invokes Http Client of android and iOS.

3

HTML5 UI frameworks for mobile applications:

The creation of web-based mobile applications can be easily supported nowadays with the use of several HTML5 based UI frameworks. The tools offered by these frameworks support UI development through simple web based languages such as HTML5 and CSS. These tools also have support for JavaScript which works well with HTML and in most cased the web-based applications developed with them can be converted to a native application with the use of PhoneGap. Some of the most widely used Javascript library frameworks for mobile web application development are jQuery Mobile and jQtouch.

ITERA 2012, The 10th Annual Conference on Telecommunications and Information Technology, 30th March-1 April 2012, Indianapolis Indiana

3.1 jQuery Mobile jQuery Mobile is based on jQuery [6] which is javascript library designed to implement client side scripting of HTML. jQuery's syntax is designed to make it easier to navigate a document, select DOM elements, create animations, handle events, and develop Ajax applications. jQuery also provides capabilities for developers to create plug-ins on top of the JavaScript library. Using these facilities, developers are able to create abstractions for low-level interaction and animation, advanced effects and high-level, theme-able widgets. This contributes to the creation of powerful and dynamic web pages. The basic example which uses jQuery is shown below. < ! DOCTYPE html> < head> < title> jQuery demo< /title> < /head> < body> < a href = http://jquery.com> jQuery< /a> < script src= http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js> < /scipt> < script> $(document).ready(function () {

Event.preventDefault(); }); }); < /script> < /body> < /html>

1. 2.

jQuery.js is the main javascript library from which we can use different features explained above. Ready() function is used to run the javascript functions once the html page is completely loaded. ready() function checks if the page is completely loaded and then executed the javascripts.

The jQuery Mobile framework has lots of advantages. It provides a platform for web developers to engage into mobile application development facilitating an easy and comfortable transition from the normal web development to mobile web development. Some of the key features of the framework are listed below. It employs the core of jQuery core, HTML5 and CSS enabling web developers to build cross-platform and cross browser mobile solutions with interactive touch screen UI. It is a light weight framework which provides developers an easy syntax and simplifies web-based application development. It supports AJAX navigation enabling users to navigate to and from internet web pages from within an appli context and thus provide smooth interactions across applications. It supports the latest version of most of the browsers such as Chrome, Safari, Firefox, IE and Opera. It provides control features and UI widgets which allow mobile web developers to create rich touch screen UI. 3.2 jQtouch jQtouch [7] is another jQuery-based mobile framework with support for native animations, automatic navigation, and themes for mobile WebKit browsers like iPhone, G1 (Android), and Palm Pre. It has the following features. Easy to install Entirely customizable with selector options Theme support, including default Apple and jQTouch custom themes Callback functions throughout, including swipe and orientation change detection ITERA 2012, The 10th Annual Conference on Telecommunications and Information Technology, 30th March-1 April 2012, Indianapolis Indiana

Page history management and CSS3 page transitions, including 3D flip Easily allow apps to run in full screen mode with custom icons and startup screens AJAX support 4

Debugging HTML5 and JavaScript applications:

One of the traditional advantages of native application development is the ease of access to debugger and debugging environment tools. These tools give the developer the capability to analyze memory allocation and performance characteristics for each process of the application. In Android, there is a debugging tool called ADB (Android Debug Bridge) which helps in debugging Android Applications. ADB has a plug-in for integration with the popular Eclipse IDE. In iOS, the debugger is integrated with Xcode which is the IDE provided with iOS SDK. X-Code allows developers to debug iOS applications on iPhone and iPad emulators. It provides very detailed information such as memory allocation, CPU usage etc. While some platforms such as Titanium, Air play and Adobe provide a built in debugger, there is a need for a standard debugger which can debug all cross-platform (HTML5 and Javascript) applications. There are some tools available to debug cross-platform HTML5 applications, but they are not as powerful and detailed as native SDK debuggers. 4.1 Weinre Weinre [8] is an open source debugging tool which provides capabilities to debug mobile web applications. It is a desktop application which allows us to connect to remote mobile-web application running on a device or emulator. It can debug both mobile-web and hybrid applications which are built with PhoneGap. Installation and running is very easy as a jar file has to be downloaded and started from the command line. The jar file is available at https://github.com/callback/callback-weinre/archives/master. Instructions for installing and running the tool can be found at http://phonegap.github.com/weinre/Installing.html. The source files can be uploaded to any web server and the link of the debugging tool can be included the main JavaScript file. A screenshot of an example configuration is provided in Figure 1. This tool is also interactive which means, components of HTML files can be inspected and changed. The effect of the changes can be observed in the application with almost no delay. This way, we can easily explore the HTML code where there is an issue and fix it, an example of this capability is shown in Figure 2.

Figure 1

ITERA 2012, The 10th Annual Conference on Telecommunications and Information Technology, 30th March-1 April 2012, Indianapolis Indiana

Figure 2

4.2 Google Chrome Web Inspector Google Chrome Web Inspector [9] is a part of Google Chrome Developer Tools for integrated environment for debugging, optimizing and understanding a web application. One can perform a live edit the HTML, JavaScript and CSS elements, debug applications and analyze the execution times of coded functions during runtime. The developer tools can be used to analyze SQL data, inspect web elements and insert alert statements to check the values of variables. A screenshot of the tool is provided below (Figure 3).

Figure 3

4.3 Ripple Ripple [10] is a multi-platform mobile emulator widget that can be installed as a plugin to Chrome and can be used as a debugger for HTML5 mobile applications. It allows developers to visualize their applications on multiple platforms at a time. The platforms supported are WebWorks, WAC, Opera, PhoneGap and Vodafone. It is built as a chrome extension which utilizes back-end services to provide interface to debug HTML5 elements and analyze SQL data. Once the plugin has been installed, we just need to enable Ripple by right clicking on the web browser and select Ripple. Once it has been selected, options are provided to select one of the multiple platforms mentioned above. The screenshot for an example running on PhoneGap is provided in Figure 4.

ITERA 2012, The 10th Annual Conference on Telecommunications and Information Technology, 30th March-1 April 2012, Indianapolis Indiana

Figure 4

5

Conclusion: Feature Comparison of all the platforms:

-platform mobile applications. Selecting a platform completely depends on the requirements of the application. All of the platforms analyzed in this paper have both advantages and disadvantages. Table 1 provides a comparison of features among the platforms. Based on our research, we found that crossmobile application development. Not only individuals, but many companies are investing resources in learning and using these some very i quality of applications is still debatable. Native application development will always be preferred by those who are comfortable with native pr -platform development have provided an opportunity to expand the range of technology enthusiasts and developers that can participate in the mobile application development domain.

ITERA 2012, The 10th Annual Conference on Telecommunications and Information Technology, 30th March-1 April 2012, Indianapolis Indiana

Table 1. Feature Comparison PLATFORM/ CAPABILITIES Mobile Platforms supported OS Languages

Tools required for environment setup IDE used for development Support to LBS (Maps, location, GPS) Camera, Blueetooth, Audio Barcode Reader API Accelerometer/Screen Rotation FileSystem Access DataBase Capability Cloud Services for App Development

RHOMOBILE iphone/ipad, android, blackberry,windows 6.1, symbian Windows, MAC OS, ERB templates with Javascript,html, css Java 1.6 or higher, ruby, rubygems,GNU(wind ows make utility), rhodes-gem ; User's choice; Generally used: textmate in Mac and

PHONEGAP iphone, android, blackberry, windows, symbian Windows, Mac OS Html, javascript and css, html5 support

AIRPLAY SDK iphone, android,blackberry,wi ndows,symbian, Windows, Mac OS Vanilla C++ ( version of Microsoft c++) Microsoft Visual C++ 6 and Xcode on PhoneGap. Jar with Mac Os and MAYA corresponding sdk 7 for 3d modelling environment(iphone, Titanium Mobile SDK packages and android etc..) IDE same as used Eclipse ( preferred ) Microsoft Visual for native phone and or any other tool C++ 6 and development of preference for AIRPLAY simulator

ADOBE AIR SDK jQuery Mobile Android, Blackberry, Android, Blackberry, iOS, Symbian, iOS Windows Windows, Mac OS Windows, Mac OS HTML, JavaScript, HTML5, Javascript, CSS, Adobe Flex, CSS, jQuery

yes

yes

yes

yes yes

yes No

yes

yes yes(only on android and blackberry) yes

yes yes ( MySql)

yes Only MAC OS, on windows: tcp debugging/remote Debugging ( Device /Emulator) debugging connecting yes( only for license Support/Helpdesk purchased) Developer Community Google groups

TITANIUM iphone/ipad, android, Blackberry( from second half of 2011) Windows, Mac OS HTML, Javascript, CSS and Ti API's

Adobe Air, Flash Builder tool and corresponding sdk

jquery library

Flash Builder ( Similar to Eclipse)

Eclipse, Notepad++ or Aptana

yes

yes

yes

yes yes

yes No

yes No

yes with phonegap No

yes

yes

yes

yes with phonegap

yes yes

yes yes

yes yes

yes with phonegap yes

no

yes

No

No

no

Same as used in native app development

Eclipse and inline debugger with Titanium SDK

Microsoft Visual C++ debugger

yes - Wienre debugging tool

yes yes

yes yes

yes yes

yes ( Flash Builder debugger) yes( not for free evaluation version) yes

yes yes

REFERENCES [1] Rho Mobile. Rho Mobile Inc., [2] PhoneGap. Nitobi Inc., 2005 [3] AirPlay. Ideaworks3D, 1998 [4] Adobe Air. Adobe Systems, February 25, 2008 [5] Appcelerator Titanium. Appcelerator Inc., Dec 2008 [6] jQuery . John Ressig., Jan 2006 [7] jQtouch. David Kaneda., [8] Weinre, A debugging tool . IBM Inc., 2011 [9] Chrome Developer tools, Google. [10] Ripple Emulator, Ripple Community Site., http://www.itu.int/ITUD/ict/newslog/CategoryView,category,Mobile%2Bapplications.aspx> http://www.digitalbuzzblog.com/2011-mobile-statistics-statsfacts-marketing-infographic/>

ITERA 2012, The 10th Annual Conference on Telecommunications and Information Technology, 30th March-1 April 2012, Indianapolis Indiana