Android Camera without Preview

Posted by eyurdakul on Stack Overflow See other posts from Stack Overflow or by eyurdakul
Published on 2010-03-05T10:34:11Z Indexed on 2010/03/30 1:43 UTC
Read the original article Hit count: 583

Filed under:
|
|

I am writing an android 1.5 application which starts just after boot-up.
This is a service and should take a picture without preview. This app will log the light density in some areas whatever. I was able to take a picture but the picture was black.

After googling like crazy, i came across a bug thread about it. If you don't generate a preview, the image will be black since android camera needs preview to setup exposure and focus. I've created a surfaceview and listener but the onSurfaceCreated event never gets fired.

I guess the reason is, the surface is not being created visually. I've also seen some examples of calling the camera statically with MediaStore.CAPTURE_OR_SOMETHING which takes a picture and saves in the desired folder with two lines of code but it doesn't take a picture too.

Do i need to use ipc and bindservice to call this function or do you have any suggestion to achieve my goal (taking a picture without preview) and if so, would you give me a small piece of code as example?

© Stack Overflow or respective owner

Related posts about android

Related posts about service