CF.Objective Notes -- PhoneGap, Yeah It's That Easy

July 23, 2012

PhoneGap, Yeah It's That Easy
Scott Stroz
(This talk was one of the highlights of CF.Objective for me. Scott's preso included multiple sample apps showing how to handle various aspects of PhoneGap. You'll see mentions of these sample apps in my notes, but for further info I'd recommend checking out Scott's slides and sample code.)

Can use any JavaScript you want
jQuery Mobile
Sencha
Roll your own

Tons of plugins (some have not yet been updated to work with the latest release of PhoneGap)

Adobe didn't buy PhoneGap
They bought Nitobi, the company.

Thing of Cordova as WebKit and PhoneGap as Chrome or Safari

Getting started --

1. Download Eclipse
2. Download Android SDK
3. Download Android Dev Tools
4. For these demos I am using PhoneGap Eclipse plugin for Android

Need a package name -- uniquely distinguish your app from other apps that may exist on the device.

Build the "kitchen sink" demo app
Gives a view of all the functionality that's available to us
Break it down and see how they do things
Some of the way they do things isn't the "best", was obviously written by multiple developers

PhoneGap functionality exposed as a JavaScript API
-- that's a good thing, because we already know JavaScript
When app is compiled, it's converted into JAVA
PhoneGap JS is separate from jQuery Mobile or Sencha

PhoneGap Build
Subscription based service
but there is a free version
-- whatever you upload, is free to EVERYBODY ELSE
-- can't really use it to make money on your apps

Upload to build.phonegap.com
get back app-store ready apps for
iOS
Android
Palm
Symbinan
More

Sometimes plugins aren't available on all platforms
have to use different plugins on different platforms sometimes

Device info demo
-- info we have access to, about the device itself

deviceready event
-- won't have access to everything until that event is fired
can't get info about the device until the device is "ready" to give it to you

contacts demo
a lot of functionality is "navigator.[something]"

Camera demo
comments in the "kitchen sink' app telling you about all kinds of quirks and other useful bits of info

compass demo
get me the heading where i'm at right now (1 time shot)
or can get back the new heading every X seconds

Accelerometer demo
if you start something, make sure you stop it

Network demo
a way to check the wifi connection

events demo
can watch for hitting the 'menu' and 'back' buttons, and override them, etc
when they turn the volume up/down, etc

Data retrival demo --
not a single bit of PhoneGap specific code
just jQuery / Ajax
you don't HAVE to learn the PhoneGap API if you don't need it

Debugging--
console.log()
in the "logCat" view
-- this is an Android SDK thing

PhoneGap plugins
Installation is pretty standard
add JA file to "www" folder
add