Beginning PhoneGap

43
Beginning PhoneGap Kuro Hsu @ JSGroup 2012/04/02

description

For JavaScript Group #4 2012.04.02

Transcript of Beginning PhoneGap

Page 1: Beginning PhoneGap

Beginning PhoneGap

Kuro Hsu @ JSGroup

2012/04/02

Page 2: Beginning PhoneGap

Front-End Engineer.

Core member of Drupal TW. - DrupalCamp Taipei will be held on July 7th, 2012!!

Moderator of PhoneGap CN forum - http://bbs.phonegapcn.com/forum.php

Email: kurotanshi [at] gmail.com

Blog: http://kuro.tw

Kuro Hsu (a.k.a kurotanshi)

Page 3: Beginning PhoneGap

Why PhoneGap?

Page 4: Beginning PhoneGap

Today, Mobile development is mess.

Android Java

BlackBerry Java

iOS Objective-C

Palm OS C, C++, Pascal

Symbian C++

Windows Phone C#

Page 5: Beginning PhoneGap

The Web is awesome!

Page 6: Beginning PhoneGap

Web vs. Hybrid vs. Native

Web Hybrid Native

Dev Cost Reasonable Reasonable Expensive

Dev Time Short Short Long

Portability High High None

Performance Fast Fast Very Fast

Native Functionality No Yes All

App Store Distribution No Yes Yes

Extensible No Yes Yes

Page 7: Beginning PhoneGap

What is PhoneGap ?

Page 8: Beginning PhoneGap

Basically just a webkit browser with all the chrome removed, even the menu bar, and dose everything a browser does.

What is PhoneGap ?

Page 9: Beginning PhoneGap

PhoneGap uses the native browser on the device to render the HTML/CSS/JS, and keep in mind that can affect the experience.

It allows you to author native applications with web technologies, and also keeps your apps nice and small.

What is PhoneGap ?

Page 10: Beginning PhoneGap

How does PhoneGap work?

Page 11: Beginning PhoneGap

1. Write a web app using HTML5 technologies: HTML5 / CSS / JS

How does PhoneGap work?

Page 12: Beginning PhoneGap

2. Package your web app into PhoneGap

How does PhoneGap work?

Page 13: Beginning PhoneGap

2. Package your web app into PhoneGap

How does PhoneGap work?

Page 14: Beginning PhoneGap

3. Deploy your Native App to multiple devices ( iOS, Android, Blackberry, WP 7..., and so on. )

How does PhoneGap work?

Page 15: Beginning PhoneGap

Write once, run anywhere?

So, it means...?

Page 16: Beginning PhoneGap

NO

Page 17: Beginning PhoneGap

Write once, debug everywhere.

The Truth Is...

Page 18: Beginning PhoneGap
Page 19: Beginning PhoneGap

Uses Platforms Native Control

iOS Android Blackberry webOS Symbian Windows Phone 7.5

WebKit 532.9

WebCore Javascript

Core

WebKit with V8

WebKit WebKit

with Piranah

WebKit S60 or Qt? IE9

Page 20: Beginning PhoneGap

Native Web Control

How does PhoneGap work?

FFI

Common Plugins

Custom Plugins

* FFI = Foreign Function Interface

Page 21: Beginning PhoneGap
Page 22: Beginning PhoneGap

Common Plugins: Good support across platforms.

PhoneGap API / Plugins:

Accelerometer

Camera

Capture

Compass

Connection

Contacts

Device

Events

File

Geolocation

Media

Notification

Storage

Page 23: Beginning PhoneGap

PhoneGap API / Plugins:

Page 24: Beginning PhoneGap

Custom Plugins: Treeible support across platforms, but you can make it on you own!

PhoneGap API / Plugins:

https://github.com/phonegap/phonegap-plugins

Page 25: Beginning PhoneGap

All API features are plugins.

An interface to the most common set of device functionality.

All accessible through JavaScript.

PhoneGap API / Plugins:

Page 26: Beginning PhoneGap

Android: Android SDK + Eclipse ADK (optional)

PhoneGap

And, ……

Requirements

Page 27: Beginning PhoneGap

Android: Android SDK + Eclipse ADK (optional)

PhoneGap

And, …… YOU!!

Requirements

Page 28: Beginning PhoneGap

Getting Started

Page 29: Beginning PhoneGap

Demo: First Android App - Hello World

Page 30: Beginning PhoneGap

Custom Alert

Page 31: Beginning PhoneGap

Contacts.find

Page 32: Beginning PhoneGap

Geolocation

Page 33: Beginning PhoneGap

Is it too complicated ?

Page 34: Beginning PhoneGap

AppLaud:

- A Eclipse Plugin for PhoneGap Android.

- Bundled with PhoneGap 1.4.1

- Bundled with jQuery Mobile 1.0.1 - Dramatically improved API examples

http://goo.gl/AoxZH

Tools

Page 35: Beginning PhoneGap

Demo #2: First Second Android App –

Hello World with Applaud.

Page 36: Beginning PhoneGap

Demo #3: PhotoShare with PhoneGap

https://github.com/kurotanshi/PhotoShare-Demo-with-PhoneGap

Page 37: Beginning PhoneGap
Page 38: Beginning PhoneGap
Page 39: Beginning PhoneGap

webkit on PC

Ripple Mobile Environment Emulator

weinre ( WEb INspector REmote )

Mobile Safari debugging

Mobile Debugging

Page 40: Beginning PhoneGap

Demo #4: Mobile debugging with weinre.

https://github.com/callback/callback-weinre/archives/master

Page 41: Beginning PhoneGap

PhoneGap doesn't bundle a UI framework, but they support any JS framework that works in the browser.

Conclusion

Page 42: Beginning PhoneGap

PhoneGap doesn't bundle a UI framework, but they support any JS framework that works in the browser.

PhoneGap is just a fancy browser.

PhoneGap app is more powerful web app.

Native still gives the best performance.

Conclusion

Page 43: Beginning PhoneGap

Thanks!