3

Taking a picture on Android is quite trivial:

camera.takePicture(null, null, mPicture);

My only concern is that there is no sound or visual indication.

Creating a visual shutter animation on my layout sounds complicated, but I think I can handle it, but I would really like to play the original Android camera sound.

As this sound might be specific with different manufacturers I was just wondering if that's a sound that we could easily re-use in an app.

Thank for any help

Edit:

I have found this snippet, but believe there is a better way to achieve it:

        // Play the Shutter Sound
        AudioManager meng = (AudioManager) FullscreenActivity.this.getSystemService(
                Context.AUDIO_SERVICE);
        int volume = meng.getStreamVolume(AudioManager.STREAM_NOTIFICATION);


        if (volume != 0) {
            if (_shootMP == null)
                _shootMP = MediaPlayer
                        .create(FullscreenActivity.this,
                                Uri.parse("file:///system/media/audio/ui/camera_click.ogg"));
            if (_shootMP != null)
                _shootMP.start();
        }

Source: Alex Cohn

Waza_Be
  • 39,407
  • 49
  • 186
  • 260
  • I doubt there is an SDK approved method of doing this as the default camera sound isn't really a default. It's entirely upto the OEM, and they may decide to omit it alltogether. – Raghav Sood Jan 19 '13 at 22:22
  • _As this sound might be specific with different manufacturers I was just wondering if that's a sound that we could easily re-use in an app_: the answer is **no**. Different manufacturers have no interest in sharing their custom sounds with you. The built-in Camera app is just yet another app pre-loaded on the device, not a system service or something. And it is one of the points where OEMs choose to show off and be different. **PS** I'd appreciate if you provide a [link](http://stackoverflow.com/a/3434300/192373) to my answer, not only the copy/paste. – Alex Cohn Jan 20 '13 at 09:11
  • @AlexCohn "Your ansewer" comes from a french forum (http://fr.softuses.com/236595) Sorry I didn't check the timestamp of all the google results and place where this code is shared.. ;-) – Waza_Be Jan 20 '13 at 10:26

0 Answers0