Mobile Web Applications using HTML5. L. Cotfas 14 Dec. 2011



Similar documents
SYST35300 Hybrid Mobile Application Development

Designing for the Mobile Web Lesson 3: HTML5 Web Apps

Smartphone Application Development using HTML5-based Cross- Platform Framework

Web Browser. Fetches/displays documents from web servers. Mosaic 1993

Developing Native JavaScript Mobile Apps Using Apache Cordova. Hazem Saleh

Lecture 4 Cross-Platform Development. <lecturer, date>

Multi-platform mobile application development using HTML5, JavaScript and CSS3.

the future of mobile web by startech.ro

Cross-Platform Tools

HTML5 the new. standard for Interactive Web

<Insert Picture Here>

Cross-Platform Phone Apps & Sites with jquery Mobile

Designing for Mobile Devices

Mobile Learning Application Based On Hybrid Mobile Application Technology Running On Android Smartphone and Blackberry

ios SDK possibilities & limitations

max firt.mobi martes 26 de julio de 11

How to Choose Right Mobile Development Platform BROWSER, HYBRID, OR NATIVE

Making the Most of Existing Public Web Development Frameworks WEB04

White Paper INTRODUCTION. In mobile development, there are three different types of applications: PRE-SMARTPHONE MOBILITY NATIVE MOBILE APPLICATIONS

Smart Phones Application development using HTML5 and related technologies: A tradeoff between cost and quality

Development of mobile applications for multiple platforms

HYBRID APPLICATION DEVELOPMENT IN PHONEGAP USING UI TOOLKITS

Accessing External Databases from Mobile Applications

CiviMobile & CiviSync Mobile. Peter McAndrew Rohit Thakral

HTML5 and CSS3: New Markup & Styles for the Emerging Web. Jason Clark Head of Digital Access & Web Services Montana State University Libraries

The Bootstrapper's Guide to the Mobile Web by Deltina Hay. Mobile App Strategy Worksheet. I. Target Market, App Category, Platforms

Building a Simple Mobile optimized Web App/Site Using the jquery Mobile Framework

the intro for RPG programmers Making mobile app development easier... of KrengelTech by Aaron Bartell

BUILDING MOBILE WEB APPS WITH PHONEGAP. Matt Zukowski

Issues of Hybrid Mobile Application Development with PhoneGap: a Case Study of Insurance Mobile Application

Web Anywhere. Mobile Optimisation With HTML5, CSS3, JavaScript. Bruce Lawson / SxSW/ 12 March 2011

Cross-Platform Mobile Application Development

research: technical implemenation

Building native mobile apps for Digital Factory

Enterprise Mobile Application Development: Native or Hybrid?

Dasharatham Bitla (Dash)

Developing Offline Web Application

Mobile Development Frameworks Overview. Understand the pros and cons of using different mobile development frameworks for mobile projects.

HTML5 and CSS3. new semantic elements advanced form support CSS3 features other HTML5 features

How to Build a Mobile Site with Drupal. Andrew Berry, Lullabot Harris Rashid, Chapter Three

Cross Platform App Development

Mobile Learning Basics + (Free) Mobile Learning Guide. Jason Haag and Marcus Birtwhistle

Opus: University of Bath Online Publication Store

Rich User Interfaces for Web-Based Corporate Applications

Bridging the Gap: from a Web App to a Mobile Device App

ios Hybrid Mobile Application Development

Mobile App Infrastructure for Cross-Platform Deployment (N11-38)

WEB, HYBRID, NATIVE EXPLAINED CRAIG ISAKSON. June 2013 MOBILE ENGINEERING LEAD / SOFTWARE ENGINEER

Links Getting Started with Widgets, Gadgets and Mobile Apps

Cross platform applications with HTML5

Beginning Smartphone Web Development

To mobile web app or not to mobile web app? By David Rolnitzky, Summer 2010

This page intentionally left blank

Multi-Platform Mobile Application Development Analysis. Lisandro Delía Nicolás Galdámez Pablo Thomas Leonardo Corbalán Patricia Pesado

Mobile web developer guide

Viability of developing cross-platform mobile business applications using a HTML5 Mobile Framework

A cloud based solution for enterprise mobility: Putting Windows Phone 7 into context

Chapter 2: Interactive Web Applications

INFORMATION TECHNOLOGY STANDARD

WebCenter User experience. John

<link rel="stylesheet" type="text/css" media="all" href="css/iphone.css" /> <!-- User defined styles -->

Mobile Publishing. Academy of Journalism and Media, Faculty of Economic Sciences, University of Neuchâtel Switzerland

Coding Tips You Should Know Before Distributing Your HTML5 Web App on Mobile Devices

Buzz it for real! ... the tortuous road to Mobile HTML5 Apps. Andrea Senior SW

Navigating the Mobile App Development Landscape

Mobile Application Development

Beginning Android Web

HTML5 as the Core Technology of the Mobile Enterprise

Evaluating Cross-Platform Development Approaches (WORA Tools ) for Mobile Applications

HTML5: Separating Fact and Fiction. #wipjam

To Study and Design a Cross-Platform Mobile Application for Student Information System using PhoneGap Framework

WHITE PAPER. Cross Platform Mobile Development

THE SAS OUTPUT DELIVERY SYSTEM: BOLDLY TAKE YOUR WEB PAGES WHERE THEY HAVE NEVER GONE BEFORE! CHEVELL PARKER, SAS INSTITUTE INC.

Developing mobile educational apps: development strategies, tools and business models

Leveraging Partners and Open Source Technology in your Mobility Strategy. emids webinar Thursday, August 11, :00 pm 2:00 pm EDT

Analysis of Cross-Platform Development Frameworks for a Smartphone Pediatric Application

Designing Mobile Experiences: Building Mobile Web Sites and Apps

Dealing with the Dilemma: Mobile App Development Approach & Decisions

BUILD A MOBILE APP WITH HTML5 AND JAVASCRIPT

place/business fetch details, removefromfavorite () function, 189 search button handler bind, B BlackBerry build environment

Web-based Mobile Applications

Retool your HTML/JavaScript to go Mobile

How To Develop An Html5 Based Mobile App

Cross Platform Applications with IBM Worklight

Enabling Cordova (aka PhoneGap) on Tizen. René Pourtier / Luc Yriarte

Technical and Business Challenges for Mobile Application Developers. Tony Wasserman Carnegie Mellon Silicon Valley Mobicase 2010

Using Agile to Develop Mobile Apps

Web Designing with UI Designing

HTML5 and the Mobile Web

Web Technologies Uses and Recommendations for Mobile Development

Differences between HTML and HTML 5

Agenda. 1. ZAPms Konzept. 2. Benutzer-Kontroller. 3. Laout-Aufbau. 4. Template-Aufbau. 6. Konfiguration. 7. Module.

The Development Manager s Quick Guide to HTML5

About Me. Cross-platform Mobile Development Challenges, Best Practices and more.

Review of Cross-Platforms for Mobile Learning Application Development

Best Practices in Mobile Development: Building Your First jquery Mobile App Handheld Librarian VI February 2, 2012

Best practices building multi-platform apps. John Hasthorpe & Josh Venman

The open source cross-platform application development frameworks for smart phones

DIEGO PINEDO ESCRIBANO ANALYSIS OF THE DEVELOPMENT OF CROSS-PLATFORM MOBILE APPLICATIONS Master of Science Thesis

Here s how to choose the right mobile app for you.

Transcription:

Mobile Web Applications using HTML5 L. Cotfas 14 Dec. 2011

Reasons for mobile web development Many different platforms: Android, IPhone, Symbian, Windows Phone/ Mobile, MeeGo (only a few of them)

Reasons for mobile web development Targeting more platforms with native apps Higher development and maintenance costs More time needed for development & test Few people have the necessary skills to develop using several platforms

Native applications Advantages Can use all the features of the device Better performance for resource intensive client operations Can be sold in popular application stores like: Android, iphone (also in Operator stores like Orange) Disadvantages Targeting more platforms requires a lot of time and money Slower development cycle Difficult to find developers that know all the platforms.

Simple Web Applications Advantages Can reach any mobile phone with a web browser Can be easily and frequently updated Disadvantages Simple user interface Internet connection is constantly required Can not access the features of the device. Simple CSS, JavaScript, AJAX, HTML5, CSS3 Complex + large no. of devices + smaller no. of devices but increasing fast + users that buy apps and browse the web

Complex Web Applications Characteristics Built using HTML5, AJAX, CSS3 Advantages Can reach any mobile phone with a HTML5 web browser Can access in a standard way (W3C) an increasing number of phone features: GPS (Geolocation API), Accelerometer & Gyroscope (DeviceOrientation API) Can be converted to ~native applications that can be sold through an application store Can be easily and frequently updated Advanced UI (comparable wit native applications) Internet connection is not always required.

Complex Web Applications Disadvantages Can not access all the features of the device (but a growing number of standard APIs) Fragmentation - WURFL offers a DB with available features for each phone Worse performance for resource intensive client operations Storage space is limited to ~10Mb

*Note - Microsoft ~dropped Silverlight as their platform of choice for web because they consider HTML5 as the only solution for the huge device/ browser /OS fragmentation

HTML5

Available HTML5 mobile browsers The HTML5 standard is not yet finished. The best partial mobile implementations are considered to be: iphone Android WebOS Other will follow soon

Viewport meta tag In order to prevent the mobile browser from zooming out when loading the page we can add the viewport meta tag to the <head> element. A 980px width is assumed otherwise. We can also specify if the user is able to zoom. The following tag sets the viewport width to the width of the device and disables user zoom: <meta name="viewport" content="userscalable=no, width=device-width">

Viewport meta tag Without With

UI SDKs Several UI SDKs allow the development of applications that replicate the features of native UI iwebkit (link) jqtouch (link) jquery Mobile (link) Sencha Touch (link) You can write your own CSS & JavaScript UI

UI SDKs (iwebkit) <!DOCTYPE HTML> <html > <head> <link rel="stylesheet" type="text/css" href="css/iwebkit.css"> <meta name="viewport" content="user-scalable=no, width=device-width"> <meta content="yes" name="apple-mobile-web-app-capable" /> </head> <body> <div id="topbar"> <div id="title"> Context</div> </div> <div id="content"> <fieldset> <ul class="pageitem"> <li class="checkbox"><span class="name">distance to POI</span> <input type="checkbox" /> </li> <!--.. --> <li class="checkbox"><span class="name">temperature</span> <input type="checkbox" /> </li> </ul> </fieldset> </div> </body> </html>

Client side storage In the past: Only cookies HTML5 SessionStorage data is stored with the window object and is discarded upon closing LocalStorage data is saved after the windows is closed and is available to all pages from the same source WebSQL offers a JavaScript API to store persistent data in a local SQLite database.

Local/Session Storage Example <!DOCTYPE HTML> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.4.min.js" type="text/javascript"></script> <title>session & Local Storage</title> <script type="text/javascript"> $(document).ready(function(){ //Try to set the value from session storage var valuestoredusingsessionstorage = sessionstorage.getitem('valuestoredusingsessionstorage'); $('#lbsessionstorage').text(valuestoredusingsessionstorage); }); //Try to set the value from local storage var valuestoredusinglocalstorage = localstorage.getitem('valuestoredusinglocalstorage'); $('#lblocalstorage').text(valuestoredusinglocalstorage);

Local/Session Storage Example function StoreSessionValue() { var valuestoredusingsessionstorage = $('#txsessionstorage').val(); sessionstorage.setitem('valuestoredusingsessionstorage', valuestoredusingsessionstorage); $('#lbsessionstorage').text(valuestoredusingsessionstorage); } function StoreLocalValue() { var valuestoredusinglocalstorage = $('#txlocalstorage').val(); localstorage.setitem('valuestoredusinglocalstorage', valuestoredusinglocalstorage); $('#lblocalstorage').text(valuestoredusinglocalstorage); } </script> </head> <body> <h1>session storage</h1> <input id="txsessionstorage" type="text"> <input type="submit" value="store value" onclick="storesessionvalue()"><br><br> Currently stored value: <span id="lbsessionstorage"></span> <h1>local storage</h1> <input id="txlocalstorage" type="text"> <input type="submit" value="store value" onclick="storelocalvalue()"><br><br> Currently stored value: <span id="lblocalstorage"></span> </body> </html>

WebSQL Example < script type = "text/javascript" > var db; $(document).ready(function() { if (!window.opendatabase) { alert('databases are not supported in this browser.'); return; } var shortname = 'WebSqlDB'; var version = '1.0'; var displayname = 'WebSqlDB'; var maxsize = 65535; db = opendatabase(shortname, version, displayname, maxsize); db.transaction(function(transaction) { transaction.executesql( 'CREATE TABLE IF NOT EXISTS User ' + ' (UserId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,' + FirstName TEXT NOT NULL, LastName TEXT NOT NULL);', [], function(transaction, result) {;}, errorhandler); ListDBValues(); }); });

WebSQL Example function AddValueToDB() { if (!window.opendatabase) { alert('databases are not supported in this browser.'); return; } db.transaction(function(transaction) { transaction.executesql( 'INSERT INTO User(FirstName, LastName) VALUES (?,?)', [$('#txfirstname').val(), $('#txlastname').val()], function() {alert('record added');}, errorhandler); }); return false; }

WebSQL Example function ListDBValues() { if (!window.opendatabase) { alert('databases are not supported in this browser.'); return; } } $('#lbusers').html(''); db.transaction(function(transaction) { transaction.executesql('select * FROM User;', [], function(transaction, result) { if (result!= null && result.rows!= null) { for (var i = 0; i < result.rows.length; i++) { var row = result.rows.item(i); $('#lbusers').append('<br>' + row.userid + '. ' + row.firstname + ' ' + row.lastname); } } }, errorhandler) }); function errorhandler(transaction, error) { } alert('error: ' + error.message + ' code: ' + error.code);

WebSQL Example </script> </head> <body> <h1>websql</h1> <input id="txfirstname" type="text" placeholder="firstname"> <input id="txlastname" type="text" placeholder="last Name"> <input type="button" value="add record" onclick="addvaluetodb()"> <input type="button" value="refresh" onclick="listdbvalues()"> <br> <br> <span style="font-weight:bold;">currently stored values:</span><span id="lbusers"></span> </body> </html>

Location data GPS coordinates can be obtained using the W3C Geolocation API Combining Geolocation API with Google Maps SDKs:

Example <!DOCTYPE HTML> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>geolocation API</title> <meta name="viewport" content="user-scalable=no, width=device-width"> <meta content="yes" name="apple-mobile-web-app-capable" /> <script type="text/javascript"> $(document).ready(function(){ navigator.geolocation.getcurrentposition( function (position) { alert('latitude: '+position.coords.latitude + ' Longitude: '+position.coords.longitude); } ); } ); </script> </head> <body></body> </html>

Offline Web Applications The offline application cache allows users to run web apps even when they are not connected to the internet In order to add the manifest: <html manifest= Web.manifest"> The manifest contains a list of all the files that should be cached locally (downloaded in the background)

Offline Web Applications NETWORK: always request from the server FALLBACK: fallback mechanism WEB.manifest content: CACHE MANIFEST index.html NETWOK: logo.jpg FALLBACK: images/ images/offline.jpg

Other HTML5 features 2D Canvas Animation API in HTML5 Semantic Document Structure Native Audio and Video Controls

~Native Web Apps Several frameworks allow the conversion of web application to hybrid ones that can be installed and can access more device features PhoneGap (link) RhoMobile (link) Titanium Mobile (link) Others

~Native Web Apps (PhoneGap) Microsoft Windows Phone 7 will be supported soon!* *Source: http://www.phonegap.com/about, http://wiki.phonegap.com/w/page/28291160/roadmap-planning

Further reading J. Stark, Building Android Apps with HTML, CSS, and JavaScript. O Reilly Media, Inc., 2010. S. Allen and V. Graupera, Pro Smartphone Cross-Platform Development: IPhone, Blackberry, Windows Mobile and Android Development and Distribution. Apress, 2010. G. Frederick and R. Lal, Beginning Smartphone Web Development: Building Javascript, CSS, HTML and Ajax- Based Applications for iphone, Android, Palm Pre, Blackberry, Windows Mobile and Nokia S60. Apress, 2010. W3C Geolocation API Specification - dev.w3.org/geo/api/spec-source.html

Further reading Device APIs and Policy Working Group http://www.w3.org/2009/dap/ Mobile Web Application Best Practices - http://www.w3.org/tr/mwabp/ JQTouch - http://www.jqtouch.com/ iwebkit - http://www.iwebkit.net/ jquery Mobile - http://jquerymobile.com PhoneGap - http://www.phonegap.com/