Take a photo automatically without user interaction

Android does not allow you to take picture without showing the preview window. So you have to make the surface view very small. Like 1*1 pixel and put it in a corner of any control.

Or show a dummy surface view to do this.

SurfaceView view = new SurfaceView(this);
c.setPreviewDisplay(view.getHolder());
c.startPreview();
c.takePicture(shutterCallback, rawPictureCallback, jpegPictureCallback);

Check (broken link removed), this and this out.

Leave a Comment