Developing Better PhoneGap Apps Session 608 / DevLearn 2013 Daniel Pfeiffer Lead Developer / Float Mobile Learning.

Slides:



Advertisements
Similar presentations
D4.3 Additional Applications iPad Application – Facebook Integration George Chrysochoidis i-sieve technologies ltd. PATHS Project Review, 12th March 2014,
Advertisements

Sriram DRUPAL GCI What is a drop down menu? A drop down menu is a menu of options that appears when an item is selected with a mouse. The item.
Development of mobile applications using PhoneGap and HTML 5
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
The PhoneGap History Doncho Minkov Telerik Academy academy.telerik.com Technical Trainer
 jQuery Mobile An Introduction. What is jQuery Mobile  A framework built on top of jQuery, used for creating mobile web applications  Designed to make.
Forms, Validation Week 7 INFM 603. Announcements Try placing today’s example in htdocs (XAMPP). This will allow you to execute examples that rely on PHP.
INTRODUCTION TO CLIENT-SIDE WEB PROGRAMMING ACM 511 ACM 262 Course Notes.
DHTML - Introduction Introduction to DHTML, the DOM, JS review.
DHTML. What is DHTML?  DHTML is the combination of several built-in browser features in fourth generation browsers that enable a web page to be more.
Win8 on Intel Programming Course Modern UI : Features Cédric Andreolli Intel Software.
Pittsburgh Java User Group– Dec Java PureFaces: A JSF Framework Extension.
Title slide to be used at the start of a module. Developing Mobile Apps Roland Guijt
Mobile App Support Jacob Poirier Geri Hengesbach Andrea Menke Erin Rossell.
Introduction CIS 136 Building Mobile Apps 1. What is a mobile app? 2  Computer program  Designed for small devices  Smartphones  Tablets  Other handhelds.
A really fairly simple guide to: mobile browser-based application development (part 4, JQuery & DOM) Chris Greenhalgh G54UBI / Chris Greenhalgh.
SERVER web page repository WEB PAGE instructions stores information and instructions BROWSER retrieves web page and follows instructions Server Web Server.
By: Toms Linnes Mrunal Patel.  Universal  With qooxdoo you build rich, interactive applications, native-like apps for mobile devices light weight single.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
HTML5 for Mobile Andrew Kinai. HTML vs HTML5 HTML:A language that describes documents' formatting and content, which is basically composed of static text.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
INTRODUCTION TO HTML5 Using jQuery with HTML5. Introducing jQuery  Although it is not a part of any W3C or WHATWG specification, jQuery performs an important.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
DHTML - Introduction Chapter Introduction to DHTML, the DOM, JS review.
Strategies for Building Mobile Apps Using ArcGIS API for JavaScript Andy Gup, Lloyd Heberlie.
Building Rich Web Applications with Ajax Linda Dailey Paulson IEEE – Computer, October 05 (Vol.38, No.10) Presented by Jingming Zhang.
Microsoft UI Stack Ronnie Saurenmann Technical Evangelist, Microsoft Switzerland
Unleash the Power of jQuery Doncho Minkov Telerik Software Academy academy.telerik.com Senior Technical Trainer
Use CSS to Implement a Reusable Design Selecting a Dreamweaver CSS Starter Layout is the easiest way to create a page with a CSS layout You can access.
Web Development 101 Presented by John Valance
Principles of Web Design 6 th Edition Chapter 9 – Site Navigation.
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
PERFORMANCE ENHANCEMENT IN ASP.NET By Hassan Tariq Session #1.
Unleash the Power of jQuery Learning & Development Team Telerik Software Academy.
Trunica Inc. 500 East Kennedy Blvd #300 Tampa, FL Cross Platform Mobile Apps With Cordova and Visual Studio 2015 © Copyright 2015.
The way of hybrid mobile development Hybrid Mobile Applications Telerik Software Academy
 Phone Gap is a mobile application development frame work based upon the open source apache cordova project. Developed by Nitobi software Bought by Adobe.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
Lesson 16. Practical Application 1 We can take advantage of JavaScript and the DOM, to set up a form so that the first text box of a form automatically.
Microsoft Edge F12 Use Microsoft Edge to finish turning F12 around and get her going in the right direction F12 Focus for Win10.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Chapter 1 Ionic Framework (overview) Front-end framework for developing hybrid mobile apps with HTML5 Yeunyong Kantanet School of Information and Communication.
Flux & React Web Application Development Mark Repka, Rich McNeary, Steve Mueller.
 Can access all API’s made available by OS vendor.  SDK’s are platform-specific.  Each mobile OS comes with its own unique tools and GUI toolkit.
LECTURE #4: JQUERY AND FORM VALIDATION Josh Kaine Josh Kaine 4/1/2016.
Mobile Applications With JQuery Mobile and VDF 17.1.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
丁建文 國立高雄應用科大資管系副教授 兼任計網中心軟體發展組組長 跨平台行動應用軟體開發技術 : HTML5 & Mobile JavaScript Framework 暨南大學.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
COMPARING CROSS-PLATFORM DEVELOPMENT APPROACHES FOR MOBILE APPLICATIONS Henning Heitkötter, Sebastian Hanschke and Tim A. Majchrzak Department of Information.
INTRODUCING HYBRID APP KAU with MICT PARK IT COMPANIES Supported by KOICA
APP DESIGN AND DEVELOPMENT WITH THE IONIC FRAMEWORK Chuck Leone
JavaScript Invented 1995 Steve, Tony & Sharon. A Scripting Language (A scripting language is a lightweight programming language that supports the writing.
Build Cross-Platform Mobile Apps Using Visual Studio A Telerik webinar by Jeffrey T. Fritz March 27, 2014 AND.
10 Mobile Application Framework Must Know to Launch New App.
Guide To Develop Mobile Apps With Titanium. Agenda Overview Installation of Platform SDKs Pros of Appcelerator Titanium Cons of Appcelerator Titanium.
Implementing Responsive Design
12/04/12 JQuery I took these slides from the site because they were pretty good looking. Instructions for editing school and department titles: Select.
Apache Cordova Overview
Displaying Form Validation Info
AMP.
jQuery The Easy JavaScript Nikolay Chochev Technical Trainer
Modern web applications
Modern web applications
JavaScript and the DOM MIS 2402 Jeremy Shafer Department of MIS
Office 365 Development.
Web Client Side Technologies Raneem Qaddoura
Web Programming and Design
Yale Digital Conference 2019
Presentation transcript:

Developing Better PhoneGap Apps Session 608 / DevLearn 2013 Daniel Pfeiffer Lead Developer / Float Mobile Learning

#DevLearn / Session 608 / Developing Better PhoneGap Apps PhoneGap Overview Write your app using standards-based web technologies Access native OS features using JavaScript Deploy to multiple platforms with the same codebase

#DevLearn / Session 608 / Developing Better PhoneGap Apps What PhoneGap is... A “wrapper” for your web-based apps A collection of standard APIs for accessing native device features across various platforms A standard for interacting between the native OS and JavaScript using plugins Illustration by Adobe / Yohei ShimomaeAdobe / Yohei Shimomae

#DevLearn / Session 608 / Developing Better PhoneGap Apps What PhoneGap isn’t... Magic Compiler/translator that turns your web code into native (Objective-C, Java, etc.) code The answer for every mobile app

#DevLearn / Session 608 / Developing Better PhoneGap Apps Web App vs. PhoneGap Web AppPhoneGap Accessed via web browserInstalled as an app Can be saved as a Web Clip Locally available content Able to cache some data locally No storage limits Easy to distribute/update Additional features available through plugins

#DevLearn / Session 608 / Developing Better PhoneGap Apps What is a “better” PhoneGap app? Responsive Runs “like a native app” Efficiently takes advantage of standards-based web technology while understanding the restrictions Considers the unique mobile affordances Maintainable

#DevLearn / Session 608 / Developing Better PhoneGap Apps Abstraction Taxes PhoneGap provides an abstraction layer between your app logic and the native OS There are costs to using the abstraction layer:  Performance restrictions  Missing out on very finely tuned native user controls/inputs Photo by Philip Taylor PTPhilip Taylor PT

Abstraction Tax Evasion

#DevLearn / Session 608 / Developing Better PhoneGap Apps var view = retrieveCurrentView(); var newView = createNewView(); view.parentNode.replaceChild(newView, view); Don’t navigate away from index.html The time required to tear down a page and load a new one can be completely avoided Use JavaScript to change the DOM

#DevLearn / Session 608 / Developing Better PhoneGap Apps Use touch events Users interact with mobile devices by touching—not clicking By default, most mobile browsers add ≈300ms delay for click events Try using the FastClick libraryFastClick library

Demo Touch events vs. Click events

#DevLearn / Session 608 / Developing Better PhoneGap Apps Communicate with your user Users should never have to wonder if the app is doing something Use loading indicators if something can’t be done instantly Remember, there is no “hover” state for buttons making a “down” state even more important Be prepared for users to hit buttons multiple times

#DevLearn / Session 608 / Developing Better PhoneGap Apps 1 Use instead of Buttons are designed for handling user interactions while anchor tags are for linking between pages You can disable buttons by adding the disabled attribute

#DevLearn / Session 608 / Developing Better PhoneGap Apps button:active { background-color: #F00; } button:disabled { background-color: #CCC; } Use CSS pseudo-classes :active to define the “down” state of buttons :disabled to define the “disabled” state of buttons

Let’s talk about the browser

#DevLearn / Session 608 / Developing Better PhoneGap Apps floatlearning.com on an iPhone 4

#DevLearn / Session 608 / Developing Better PhoneGap Apps cnn.com on an iPhone 4

#DevLearn / Session 608 / Developing Better PhoneGap Apps What is “reflow” (layout)? The time spent determining where elements will be drawn on the page is called “reflow” Reflow involves a lot of calculations as the browser determines how to layout the page

Applying our Understanding of Reflow

#DevLearn / Session 608 / Developing Better PhoneGap Apps Reduce the cost of a reflow Calculations use the CPU—the more complicated the DOM, the more calculations, the longer it takes Remove extraneous tags to reduce DOM depth View 1

#DevLearn / Session 608 / Developing Better PhoneGap Apps Reduce the cost of a reflow Calculations use the CPU—the more complicated the DOM, the more calculations, the longer it takes Remove extraneous tags to reduce DOM depth View 1

#DevLearn / Session 608 / Developing Better PhoneGap Apps Reduce the cost of a reflow Calculations use the CPU—the more complicated the DOM, the more calculations, the longer it takes Remove extraneous tags to reduce DOM depth Remove unused CSS rules Avoid complex CSS selectors where possible View 1

#DevLearn / Session 608 / Developing Better PhoneGap Apps var node = document.getElementById('some_element'), new_node = node.cloneNode(true); // Apply changes to the cloned node var a = document.createElement('span'), var b = document.createTextNode('some content'); a.appendChild(b); new_node.innerHTML = ''; new_node.appendChild(a); // Out with the old, in with the new node.parentNode.replaceChild(new_node, node); Reduce the number of reflows Avoid triggering unnecessary reflows Make batched changes to the DOM— don’t change one element at a time

#DevLearn / Session 608 / Developing Better PhoneGap Apps var node = document.getElementById('some_element'), new_node = node.cloneNode(true); // Apply changes to the cloned node var a = document.createElement('span'), var b = document.createTextNode('some content'); a.appendChild(b); new_node.innerHTML = ''; new_node.appendChild(a); // Out with the old, in with the new node.parentNode.replaceChild(new_node, node); Reduce the number of reflows Avoid triggering unnecessary reflows Make batched changes to the DOM— don’t change one element at a time

#DevLearn / Session 608 / Developing Better PhoneGap Apps Recalculate $('#view').animate({width:'50%'}); Use CSS animations jQuery.animate performs custom animations on a set of CSS properties jQuery.animate Changing size- or position-related CSS properties will trigger a reflow ReflowPaint

#DevLearn / Session 608 / Developing Better PhoneGap Apps #view { -webkit-transform: scale(.5,0); } Use CSS animations CSS-based animations can skip the reflow process Some CSS-based animations are hardware accelerated and occur directly on the GPU Paint

#DevLearn / Session 608 / Developing Better PhoneGap Apps Consider client-side templating Helps provide a Model-View-Controller (MVC) structure to your applicationModel-View-Controller Enhances future maintainability of the code Enables you to keep the DOM free of nodes that are not needed  Application views can be stored/manipulated in memory instead of in the DOM  Only the active view lives in the DOM

Demo jQuery-based vs. CSS animations

#DevLearn / Session 608 / Developing Better PhoneGap Apps Be mindful of memory usage Avoid excessive use of global variables  The garbage collector clears data that is no longer in scope, but global variables are always in scope  Code with well-defined scopes is easier to maintain Consider using smaller JavaScript frameworkssmaller JavaScript frameworks

#DevLearn / Session 608 / Developing Better PhoneGap Apps Share the work with plugins PhoneGap provides the standard for interacting between the native OS and JavaScript using plugins Take advantage of various OS features— including performance Illustration by Adobe / Yohei ShimomaeAdobe / Yohei Shimomae

#DevLearn / Session 608 / Developing Better PhoneGap Apps Measure Don’t make guesses as to what is causing your app to run slowly or crash Use the Safari Inspector or Instruments to measure your app and determine what to focus on improving  Memory usage over time  CPU usage over time  Time spent in reflow Use aggregated analytics reports to determine what users like and what they won’t miss

Demo Measuring your app

#DevLearn / Session 608 / Developing Better PhoneGap Apps Let’s review... ✓ Develop on the device—do not rely on the simulator ✓ Don’t navigate away from index.html ✓ Use touch events or the FastClick libraryFastClick library ✓ Use pseudo-classes like :active or :disabled ✓ Keep the DOM simple ✓ Use CSS animations (especially hardware-accelerated animations where possible) ✓ Avoid global variables ✓ Use a smaller JS librarysmaller JS library