O'Reilly logo

PhoneGap Mobile Application Development Cookbook by Matt Gifford

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Capturing audio using the devices audio recording application

The PhoneGap API allows developers the ability to interact with the audio recording application on the device and save the recorded audio file for later use.

How to do it...

We'll make use of the Capture object and the captureAudio method it contains to invoke the native device audio recording application to record our audio. The following steps will help you to do so:

  1. Create the initial layout for the application, and include the JavaScript references to jQuery and Cordova. We'll also set a stylesheet reference pointing to style.css.
    <!DOCTYPE html> <html> <head> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width;" /> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required