Reputation: 1695
I have a requirement to Capture the image without showing the Preview.. And i want to do it in the Background as a Service.
Is it possible to do that??
Upvotes: 4
Views: 4286
Reputation: 1292
It is possible to achieve. You should define a class that handles the Camera object, as in calls on Camera.open() and such. Don't provide the camera object with the following lines in order to disable the preview -
mCamera.setPreviewDisplay(mTargetHolder);
Where mTargetHolder
is the SurfaceView.
If you want to receive frame callbacks you can implement the Camera.PreviewCallback interface.
Now before you call on camera.startPreview() register you callback handler using setPreviewCallbackWithBuffer(Camera.PreviewCallback). Camera reference
With this frame data you receive from the callback you can do what ever you want. just remember that it is a raw data format. See also Camera.PictureCallback usage if you wish to take a picture.
I hope this helps. (even if not relevant)
Cheers
Upvotes: 4