O'Reilly logo

Pro Android Media: Developing Graphics, Music, Video, and Rich Media Apps for Smartphones and Tablets by Shawn Van Every

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

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 ...

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