49
Getting started with 010PHP, October 10 th 2013

Getting started with PhoneGap

Embed Size (px)

DESCRIPTION

Introduction talk on Phonegap. Tells you why you should care about mobile, and how to start off using Phonegap. After seeing this presentation you should be able to start a Phonegap project pretty rapidly and feel comfortable with the file structure you're working in and structures of the platforms you're building your app for.

Citation preview

Page 1: Getting started with PhoneGap

Getting started with

010PHP, October 10th 2013

Page 2: Getting started with PhoneGap

And you are?

Patrick van Kouteren

Lead developer – Infopact Netwerk & Communicatie

Developer (& owner) – WeDesignIt

F1, Running, Aquaria, CODING

pvankouteren

@pvankouteren

IRC pvankouteren

Page 3: Getting started with PhoneGap

Mobile facts and estimates(http://www.smartinsights.com/mobile-marketing/mobile-marketing-analytics/mobile-marketing-statistics/)

Page 4: Getting started with PhoneGap

Increments in mobile share of web traffic in just two years:

North America: +69%Asia: + 192%

Africa is getting started..

Page 5: Getting started with PhoneGap
Page 6: Getting started with PhoneGap
Page 7: Getting started with PhoneGap

Joining the OS party..

Page 8: Getting started with PhoneGap

Application considerations

Target audience? App? WebApp? Responsive website? Focus on one or a couple of platforms?

Page 9: Getting started with PhoneGap

Introducing Phonegap

Adobe / Nitobi Apache Cordova Goal: to cease to exist Abstraction for many platforms, different

programming languages

Page 10: Getting started with PhoneGap

What does it do?

• HTML5 container

• Javascript APIs to device functionalities

• Plugins

Page 11: Getting started with PhoneGap

How to install

• Prerequisite: Node.js

• Dependent on build type: target platform(s) SDK(s)

Installing:

Page 12: Getting started with PhoneGap

Getting started: Phonegap CLI

Page 13: Getting started with PhoneGap

Getting started: Phonegap CLI

Page 14: Getting started with PhoneGap

Getting started: Phonegap CLI

Page 15: Getting started with PhoneGap

Getting started: Phonegap CLI

Page 16: Getting started with PhoneGap

File structure

• merges

• platforms

• plugins

• www

Platform specific code to merge

Build output per platform

Project plugins

Project code

Page 17: Getting started with PhoneGap
Page 18: Getting started with PhoneGap

config.xml

• App name, description, author

• App behavior (“preferences”)

• App permissions (“preferences”)

• Icon and splash screen locations

• Whitelisting of domains (like urls for in-app browser)

Page 19: Getting started with PhoneGap

config.xml: preferences

Page 20: Getting started with PhoneGap

Creating an app..

• HTML5

• CSS: plain, Twitter Bootstrap, TopCoat

• Javascript: plain, AngularJS, Ember, Backbone.js, Knockout.js, Knockback.js, Spine…

And/or

• Frameworks/libaries: jQuery mobile (tip: save time, use the themeroller..), Sencha, Phone.js

Page 21: Getting started with PhoneGap

Creating an app..

• Still kind of a wild west..

• Use what works for you

• For the sake of speed: layers and code size

Page 22: Getting started with PhoneGap

Creating an app: HTML

Page 23: Getting started with PhoneGap

Creating an app: Javascript

Page 24: Getting started with PhoneGap

App testing: Javascript

• Unit testing: Jasmine provided on creation

• Selenium, appium

Page 25: Getting started with PhoneGap

App testing: User testing

• Regular browser testing

• Browser plugin: Ripple

• Devices > browser!

Page 26: Getting started with PhoneGap

App testing: User testing

Page 27: Getting started with PhoneGap

App testing: User testing

Page 28: Getting started with PhoneGap

App testing: User testing

Page 29: Getting started with PhoneGap

App testing:

• Once built: Simulators for Android, Xcode etc.

Page 30: Getting started with PhoneGap

Building

• Local: SDKs needed!

• Remote: build.phonegap.com

• 1st private app / Open source: free

• 2-25 private apps: >= $ 10/month

Page 31: Getting started with PhoneGap

Building local on CLI

Page 32: Getting started with PhoneGap

Building local on CLI

Page 33: Getting started with PhoneGap
Page 34: Getting started with PhoneGap

Looks familiar?

Page 35: Getting started with PhoneGap

Applied config.xml

Page 36: Getting started with PhoneGap

Testing on devices

• Browser never as accurate as device

• Various screen sizes and resolutions

• Input lag

• Touch instead of mouse: drag / swipe events

Page 37: Getting started with PhoneGap

Testing on devices

Page 38: Getting started with PhoneGap

Testing on devices

OpenDeviceLab

http://opendevicelab.com

Page 39: Getting started with PhoneGap

Phonegap is an awesome tool..

but...

Page 40: Getting started with PhoneGap

.. not unlimited awesome

• Abstraction layer: less responsive than native

• It uses browser components of OS

• Yes, browser related stuff still holds

(who wants to work with Windows Mobile now?)

• Games: canvas, javascript, hardware rendering

Page 41: Getting started with PhoneGap

Platforms and tools support

Page 42: Getting started with PhoneGap

Platforms and tools support

Page 43: Getting started with PhoneGap

Some issues I encountered..

• (iOS) fixed header: initial scollpane offset

• Fix: trigger window resize on start

• (Android < 3, jQuery Mobile) <select> items not showing

• Fix: data-native-menu=“false”

Page 44: Getting started with PhoneGap

Some issues I encountered..

• (iOS) Splash screen config: statusbar on splash screen display

• Fix: Enable this in CODE, not in Xcode

• (Android) Splash screen duration: config setting not used

• Fix: Enable this in code

Page 45: Getting started with PhoneGap

Summarized

• Many platforms out there (still increasing)

• HTML, CSS, JS -> native project with container

• Powerful CLI tool

• No standards: Pick the tools that work for you

• Testing options, UX: device > browser

• Support for many platforms, APIs, but not all

Page 46: Getting started with PhoneGap

Future

• Native vs. HTML5

• HTML5 app structure seems to converge:

• Chrome apps

• Firefox OS (mobile + TV!)

• Phonegap

• Tizen (mobile + TV!)

• By 2014, mobile internet expected to take over desktop usage

Page 47: Getting started with PhoneGap

Useful resources

• http://docs.phonegap.com

• http://diveintohtml5.info

• http://coenraets.org/blog/

• http://devgirl.org

• http://phonegap-tips.com

Page 48: Getting started with PhoneGap

Questions?

Page 49: Getting started with PhoneGap

Thanks!

Questions, comments:

pvankouteren | @pvankouteren | IRC pvankouteren