Audio Capture with an Intent
The easiest way to simply allow audio recording capabilities in an application is to leverage an existing application through an intent that provides recording capabilities. In the case of audio, Android ships with a sound recorder application that can be triggered in this manner.
The action used to create the intent is available as a constant called RECORD_SOUND_ACTION
within the MediaStore.Audio.Media
class. Here is the basic code to trigger the built-in sound recorder.
Intent intent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);
startActivity(intent);
Figure 7–1 shows the built-in audio recording application as triggered by an intent.
Figure 7–1. Android's built-in sound recorder triggered with ...
Get Pro Android Media: Developing Graphics, Music, Video, and Rich Media Apps for Smartphones and Tablets now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.