Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

CHAPTER 15: Going Native with PhoneGap > PhoneGap API Overview

PhoneGap API Overview

The PhoneGap API is the complete API that's installed by default after you install PhoneGap. So out of the box you can do quite a bit, all with a little JavaScript.

I go over a short summary of the API below along with some methods and properties of these objects as this could give you a taste of what's possible with a little JavaScript and a powerful native library (PhoneGap).

Accelerometer

This allows you to capture motion in the x-, y-, and z-directions. You can use the accelerometer object with PhoneGap or use native Safari.

  • accelerometer.getCurrentAcceleration
  • accelerometer.watchAcceleration
  • accelerometer.clearWatch
Camera

This object gives you the ability to interact with your phone's camera. There are options to save your photo to your photo library, or an album. The image is returned as a Base64 encoded string, however, you can still save locally and then use a method to return a string of the file's location for future processing.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial