5-7. Recording Audio
You have an application that needs to use the device microphone to record audio input.
(API Level 1)
Use the MediaRecorder to capture the audio and store it out to a file.
How It Works
MediaRecorder is quite simple to use. All you need to provide is some basic information about the file format to use for encoding and where to store the data. Listings 5-24 and 5-25 provide examples of how to record an audio file to the device’s SD card, monitoring user actions for when to start and stop.
Important In order to use MediaRecorder to record audio input, you must also declare the android.permission.RECORD_AUDIO permission in the application manifest.
Listing 5-24. res/layout/main.xml
<?xml version="1.0" ...