This document summarizes the capabilities and APIs available in PhoneGap for building cross-platform mobile apps. It discusses features like accessing native platform features from JavaScript, supporting multiple mobile platforms, and the PhoneGap Build service for compiling assets into native binaries. It also provides overviews and examples of APIs for device properties, notifications, network information, sensors like accelerometer and compass, the camera, and contacts.
Building Cross-Platform Mobile Applications with HTML5
1.
2. Framework for cross-platform mobile apps
Access native platform features from JavaScript
Supports most major mobile platforms
PhoneGap Build builds native packages
8. navigator.notification provides methods for
prompting and alerting users
Method Description
alert Displays an alert box or dialog box
beep Plays an audible beep
confirm Displays a confirmation dialog
vibrate Vibrates the device for the specified number of seconds
12. window.device properties provide information
about host device
Property Description
name Device name
phonegap PhoneGap version
platform Operating system name
uuid Device ID
version Operating system version
13.
14. Events fired by PhoneGap for suspending,
resuming, back-button presses, and more
Event Description
deviceready Fired when PhoneGap is fully loaded and initialized
pause/resume Fired when application is paused (suspended) or resumed
online/offline Fired when network connection status changes
batterylow Fired when battery is low (level is device-specific)
batterycritical Fired when battery is critically low (level is device-specific)
backbutton Fired when the back button is pressed
18. navigator.accelerometer provides API for getting
acceleration vectors at specified intervals
Method Description
getCurrentAcceleration Gets current X, Y, and Z acceleration vectors
watchAcceleration Provides acceleration vectors at specified time intervals
clearWatch Cancels a watch created with watchAcceleration
22. navigator.compass provides API for getting
compass headings at specified intervals
Method Description
getCurrentHeading Gets the current heading (heading and magnetic)
watcHeading Provides the heading at specified time intervals
clearWatch Cancels a watch created with watchHeading
Provides a new heading every time it changes by the
watchHeadingFilter specified number of degrees
clearWatchFilter Cancels a watch creates with watchHeadingFilter
26. Navigator.camera provides API for shooting
photos and choosing photos from the pictures
library
Method Description
Snaps a photo with the camera, or returns a photo selected from
getPictures the pictures library
31. navigator.contacts provides API for creating new
contacts and finding existing ones
Method Description
create Creates a contact
find Queries the contacts database and returns matching contacts