O'Reilly logo

PhoneGap 4 Mobile Application Development Cookbook by Zainul Setyo Pamungkas

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 device audio recording application

PhoneGap, through the Cordova media-capture plugin API, gives developers the ability to interact with the audio recording application on their 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 of the media plugin API. The method will invoke the native device audio recording application to record our audio:

  1. Firstly, create a new PhoneGap project named audiorecord by running the following command:
    phonegap create audiorecord com.myapp.audiorecord audiorecord
    
  2. Add the device's platform. You can choose to use Android, iOS, or both:
    cordova platform add ios
    cordova platform add android
    
  3. Add the media-capture ...

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