Apache Cordova API Cookbook

Book description

Using Apache Cordova, mobile developers can write cross-platform mobile apps using standard HTML5, JavaScript, and CSS, and then deploy those apps to every leading mobile platform with little or no re-coding. Apache Cordova API Cookbook provides experienced mobile developers with details about how each Cordova API works and how to use the APIs in their own applications. Coverage is included for all Cordova/PhoneGap 3 APIs.

Instead of just showing short snippets of code to explain a particular API, this guide is chock full of complete examples. You’ll find more than thirty complete Cordova applications that work on Android, iOS, Windows, and more. The sample applications demonstrate exactly what each API does and how it works, while the chapter content describes the limitations on the leading target platforms (and even offers possible workarounds).

Through realistic “cookbook” example code, mobile developer John Wargo helps you master the Cordova APIs and understand how to use them in your Cordova applications.

Topics include

  • Accelerometers, compass, and geolocation

  • Image, video, and audio–capture, playback, and management

  • Determining connection and device information

  • Interacting with the Contacts application

  • Responding to application events

  • Accessing the device file system

  • Globalizing apps

  • Using the InAppBrowser

  • Notifications

  • Custom splash screens 

  • Special care has been taken to make the code easily readable and digestible by the reader. This guide provides the most accessible coverage, anywhere, of Apache Cordova APIs.

    Table of contents

    1. Contents
    2. 1. Introduction to Apache Cordova
      1. Introduction to Apache Cordova
      2. Supported Platforms
      3. Coding Cordova Applications
      4. Configuring a Cordova Development Environment
      5. Building Cordova Applications
      6. Anatomy of a Cordova Application
      7. Resources
      8. Wrap Up
    3. 2. Accelerometer
      1. Measuring Device Orientation
      2. Watching a Device’s Orientation
      3. What Can go Wrong?
    4. 3. Camera
      1. Taking a Picture
      2. Configuring Camera Options
      3. iOS-Only Capabilities
      4. What Can Go Wrong?
    5. 4. Capture
      1. Using the Capture API
      2. Configuring Capture Options
      3. Capture in Action
      4. What Can Go Wrong?
    6. 5. Compass
      1. Getting the Device Heading
      2. Watching the Device Heading
      3. What Can Go Wrong
    7. 6. Connection
      1. Using the Connection API
      2. An Example
      3. What Can Go Wrong
    8. 7. Contacts
      1. Creating a Contact
      2. Searching for Contacts
      3. Cloning Contacts
      4. Removing Contacts
      5. What Can Go Wrong
    9. 8. Device
      1. Using the Device API
      2. An Example
      3. What Can Go Wrong
    10. 9. Events
      1. Managing Event Listeners
      2. deviceready Event
      3. Application Status Events
      4. Battery Status Events
      5. Button Events
      6. Network Status Events
      7. What Can Go Wrong
    11. 10. File
      1. Storage Locations
      2. Accessing the Device’s File System
      3. Reading Directory Entries
      4. Accessing FileEntry and DirectoryEntry Properties
      5. Writing Files
      6. Reading Files
      7. Deleting Files or Directories
      8. Copying Files or Directories
      9. Moving Files or Directories
      10. Transfering Files
      11. What Can Go Wrong
    12. 11. Geolocation
      1. Getting a Device’s Current Location
      2. Watching a Device’s Location
      3. What Can Go Wrong
    13. 12. Globalization
      1. Example Applications
      2. Using the Globalization API
      3. Currency
      4. Date
      5. Language and Locale
      6. Number
      7. What Can Go Wrong
    14. 13. InApp Browser
      1. Example Application
      2. Managing an InAppBrowser Window
      3. InAppBrowser Events
      4. Executing Scripts in an InAppBrowser Window
      5. Insert CSS
      6. What Can Go Wrong
    15. 14. Media
      1. The Media Object
      2. Playing Audio Files
      3. Media Playback in Action
      4. Recording Audio Files
      5. Media Recording in Action
      6. What Can Go Wrong
    16. 15. Notification
      1. Visual Alerts
      2. Getting Input
      3. Audible and Tactile Notifications
      4. What Can Go Wrong
    17. 16. Splashscreen
      1. Using the Splashscreen API
      2. Using Custom Splash Screen Images
      3. What Can Go Wrong

    Product information

    • Title: Apache Cordova API Cookbook
    • Author(s):
    • Release date: July 2014
    • Publisher(s): Addison-Wesley Professional
    • ISBN: 9780133838558