© 2011 SpringOne 2GX 2011. All rights reserved. Do not distribute without permission.
Roy Clarkson and Keith Donald
SpringSource, a division of VMware, Inc.
Making the Mobile Web Native with PhoneGap
2
Agenda
• Introduction
• Support for Android and iOS
• PhoneGap API & Plugins
• PhoneGap Build• Remote Debugging• html5expense reference app walk-through
• Q&A
4
What problem are we trying to solve?
• Each device has a different native development SDK and associated programming language
• For a variety of reasons, it may not be feasible to build and maintain multiple native apps
• How can we reach all these different devices and app stores?
6
What is the solution?
• Build your application using web standards like HTML5, CSS3, and JavaScript.
• But what about accessing other features of the device, such as the camera or contacts list?
7
What is PhoneGap?
“PhoneGap is an HTML5 app platform that allows you to author native applications with web technologies and get access to APIs and app stores. PhoneGap leverages web technologies developers already know best... HTML and JavaScript.” - phonegap.com
8
PhoneGap and Nitobi in the News
• In October 2011, Adobe acquired Nitobi enabling the team to focus solely on the PhoneGap project and continue its work on efficient expressive design and development across devices.
• The PhoneGap code was contributed to the Apache Software Foundation (ASF) under the name Apache Callback in October 2011. It is currently under incubation until it can become a full Apache project.
9 © 2011 SpringOne 2GX 2011. All rights reserved. Do not distribute without permission.
Support for iOS and Android
12 © 2011 SpringOne 2GX 2011. All rights reserved. Do not distribute without permission.
Phonegap API and plugins
13
Phonegap Core Device APIs
• Accelerometer
• Camera / Media Capture
• Connection
• Compass• Contacts• Events / Notifications
• File
• Geolocation
• Storage
14
Phonegap Core Device APIs (2)
• API Documentation– http://docs.phonegap.com/en/1.1.0/
• Source Code– Android: https://github.com/callback/callback-android– IOS: https://github.com/callback/callback-ios
15 © 2011 SpringOne 2GX 2011. All rights reserved. Do not distribute without permission.
Demo: Phonegap APIs
16
Phonegap Plugins
• Moving toward “everything is a plugin” model
• Core “plugins” included by default
• New plugins can be added / developed in a consistent way– JavaScripts– Native bridging for each platform e.g .java
• Source Code– https://github.com/phonegap/phonegap-plugins
17 © 2011 SpringOne 2GX 2011. All rights reserved. Do not distribute without permission.
Demo: Plugins
18
PhoneGap Build
• Cross platform– iOS– Android– webOS– Symbian– BlackBerry
• No local setup required
• Supports Git
• https://build.phonegap.com/
19 © 2011 SpringOne 2GX 2011. All rights reserved. Do not distribute without permission.
Demo
Getting started with Phonegap Buildhttps://build.phonegap.comhttps://github.com/kdonald/hello-phonegap
20
• Weinre– Debugger for web pages– Designed to work remotely– Debug web pages on a phone
• Availability– http://debug.phonegap.com/– http://phonegap.github.com/weinre/
Debugging
21 © 2011 SpringOne 2GX 2011. All rights reserved. Do not distribute without permission.
Demo
Remote debugging demo
22
• Phonegap 1.1.0
• jquery Mobile
• Camera API
• “Stopgap” for portability• PhoneGap build for native builds
– Also created native projects so we can do local builds
• Weinre for remote debugging
• “Hydra” for dynamic update capability
html5expense walkthrough