20 Recipes for Programming PhoneGap

Book description

Gain hands-on experience with the amazing PhoneGap library, using the practical recipes in this handy guide. With these solutions, you can enable your mobile web apps to interact with device-specific features such as the accelerometer, GPS, camera, and address book. Learn how to use your knowledge of HTML, CSS, and JavaScript to build full mobile apps for iOS, Android, and several other platforms without rewriting apps in the native platform language. Each recipe includes sample code you can use in your project right away, as well as a discussion of why the solution works.

  • Add functionality that’s available only on a certain device or platform
  • Retrieve the device’s current GPS location and place a marker on a map
  • Create and save a new contact or edit an existing contact in the address book
  • Take pictures with the camera or select one of the user’s existing photos
  • Upload a file from the local device to an external server
  • Allow the device to record audio or video through your app
  • Enable your application to save files locally

Table of contents

  1. 20 Recipes for Programming PhoneGap
  2. SPECIAL OFFER: Upgrade this ebook with O’Reilly
  3. Preface
    1. About the Book
    2. Prerequisites
    3. Conventions Used in This Book
    4. Tools
    5. Using Code Examples
    6. Safari® Books Online
    7. How to Contact Us
    8. Acknowledgments
  4. 1. The Recipes
    1. 1.1. Determining Whether the Device Is Ready
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    2. 1.2. Retrieving Information About the Device
      1. Problem
      2. Solution
      3. Discussion
    3. 1.3. Creating a Persistent Navigation System
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    4. 1.4. Detecting the Device’s Network Status
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    5. 1.5. Detecting When the Network Status Changes
      1. Problem
      2. Solution
      3. Discussion
    6. 1.6. Executing a Callback Function Once the Device Is Ready
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    7. 1.7. Detecting When the App Is Moved to the Background or Foreground
      1. Problem
      2. Solution
      3. Discussion
    8. 1.8. Using the GPS and Displaying a Position on a Map
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    9. 1.9. Using the Compass to Help the User Navigate
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    10. 1.10. Using the Accelerometer to Detect Motion
      1. Problem
      2. Solution
      3. Discussion
    11. 1.11. Displaying Table-View Data
      1. Problem
      2. Solution
      3. Discussion
    12. 1.12. Retrieving Contacts in the Address Book
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    13. 1.13. Creating a New Contact in the Address Book
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    14. 1.14. Accessing the Camera and Photo Album
      1. Problem
      2. Solution
      3. Discussion
    15. 1.15. Saving Data to a Remote Server
      1. Problem
      2. Solution
      3. Discussion
    16. 1.16. Capturing Audio and Video
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    17. 1.17. Notifying the Device with Alert, Confirm, and Vibrate
      1. Problem
      2. Solution
      3. Discussion
    18. 1.18. Storing Data to the Device
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    19. 1.19. Reading Data from the Device
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    20. 1.20. Extending PhoneGap with Plug-ins
      1. Problem
      2. Solution
      3. Discussion
  5. About the Author
  6. SPECIAL OFFER: Upgrade this ebook with O’Reilly

Product information

  • Title: 20 Recipes for Programming PhoneGap
  • Author(s): Jamie Munro
  • Release date: March 2012
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781449334406