PhoneGap & The Android Back Button (0.9.5)

In PhoneGap 0.9.5 they’ve updated how the Android back button works. Here’s what to change.

Before in 0.9.4:

BackButton.override();
document.addEventListener("backKeyDown", function() {
    someBackButtonHandlingFunction();
}, true);

Now in 0.9.5:

document.addEventListener("backbutton", function() {
    someBackButtonHandlingFunction();
}, true);

In 0.9.5 and later you no longer need to override the back button, as it’s assumed when you’re adding the event listener that you want to handle the button yourself. Make sure if the user is at the root view of your mobile app, the back button closes the app.

To exit the app in 0.9.4 you’d use:

BackButton.exitApp();

Now, in 0.9.5 you need to use:

device.exitApp();

Good to see PhoneGap advancing to a more device agnostic syntax.

Android 2.3 Gingerbread Released

Nexus S - Google Phone

Nexus S - Google Phone

Android 2.3 Gingerbread Home Screen

Android 2.3 Gingerbread Home Screen

So Android 2.3 is being rolled out the next few days, and will be available on the Nexus One and the new Nexus S initially. It’s got some much needed UI tidying up (till HTC get to it), but here’s what else is cool in it:

Android 2.3 iPhone like Copy & Paste

Android 2.3 iPhone like Copy & Paste

iPhone-esque Select, Copy and Paste

You can now select a group of text easily without using the trackball.

Tapping on a single word also selects it.

Front Facing Camera support on Android 2.3

Front Facing Camera support on Android 2.3

Front Facing Camera

Sure lots of third party apps will support this, but I wonder if we’ll see a Google FaceTime competitor? They’ve got the infrastructure in place, so I’m sure it’s coming..

Near Field Communications on Android 2.3

Near Field Communications on Android 2.3

NFC– Near Field Communications

Think of this as QR codes without the aggravation of having to fire up the camera and waiting for focus. Expect these to be popping up everywhere over the next 12-18 months.

Other notables

  • ‘Overscroll’ – kinda like bounce scroll on iPhone, an effect to hint when you get to the beginning or end of a scrollable area
  • Support for ‘Extra Large’ Screens – hints at tablet support finally coming
  • Download Manager – universal across all apps, something iOS currently lacks
  • SIP Support – make phone calls over the web
  • Extended sensor support- gyroscope, rotation vector, linear acceleration, gravity, and barometer hardware now supported
  • VP8 and WebM- video codecs Google are pushing for HTML5 video

Here’s the official summary video: