camera – Android: takePicture() not making sound-ThrowExceptions

Exception or error:

I am using the takePicture() method from the Camera class. It takes the picture , but it makes no sound! My client wants the default click sound that Android makes.

I have seen other threads and it seems that the problem is in disabling the sound, not the opposite! Why is it that my app is not making the click sound??

How to solve:

I also had this problem. I solved it by using following code:
The following is used to call takePicture:

clickButton.setOnClickListener(new View.OnClickListener() {

            public void onClick(final View view) {
                mCamera.takePicture(shutterCallback, null, onPicTaken);

Now shutteerCallBack:

private final ShutterCallback shutterCallback = new ShutterCallback() {
        public void onShutter() {
            AudioManager mgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

Now Do whatever after taking picture from camera:

     * This will be called after taking picture from camera.
    final transient private PictureCallback onPicTaken = new PictureCallback() {
         * After taking picture, onPictureTaken() will be called where image
         * will be saved.
        public void onPictureTaken(final byte[] data, final Camera camera) {

This will play sound on clicking capture button.

Thank you 🙂


If you want a camera to play the default android sound, you have to give it an empty shutter callback.

ShutterCallback shutterCallback = new ShutterCallback() {
    public void onShutter() { 
        /* Empty Callbacks play a sound! */

mCamera.takePicture(shutterCallback , null, onPicTaken);

Tested on HTC One SV and Samsung Galaxy XCover 2.

You give the callback an empty shutter callback and then it plays the default sound.

If you call takePicture with a null ShutterCallback the camera won’t play any sound.

The answer of Shrikant is working, but might behave unexpectedly as mgr.playSoundEffect(); is not intended to be called with AudioManager.FLAG_PLAY_SOUND as the doc states.

Leave a Reply

Your email address will not be published. Required fields are marked *