Home:ALL Converter>Take picture automatically with MediaStore Intent

Take picture automatically with MediaStore Intent

Ask Time:2011-06-29T09:01:12         Author:William Stewart

Json Formatter

What I am looking to do is to capture an image on a button click, without requesting any other input from the user.

At the moment I'm using a MediaStore.ACTION_IMAGE_CAPTURE intent inside my activity, which is called when pressing a button on a widget. At the moment this opens the camera preview allowing me to take a picture.

That's all working great, however what I'm looking to do is when the user presses the button on the widget, take the picture straight away and display a preview of the captured image. So it essentially snaps the picture automatically, without the need for the user to press anything else.

I tried using the Camera API directly, using a SurfaceView class to capture the image and call the PictureCallback etc, this worked how I want it to, however the quality of the images was very low and I couldn't figure out how to change it.

So I guess I'm looking for an answer to either of those two problems, or both if anyone knows them.

Firstly, is there anyway, using something similar to a MediaStore.ACTION_IMAGE_CAPTURE intent to snap the image automatically without requesting the user to take the picture.

Or secondly, how can I increase the quality and resolution of an image captured using the Camera API directly (camera.takePicture(shutterCallback, rawCallback, jpegCallback); and all that business).

Any help would be much appreciated.

Author:William Stewart,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/6514717/take-picture-automatically-with-mediastore-intent
yy