If it possible to retrieve camera pic in background and save the pic every 30 seconds?
Does anyone have example? Thanks.
If it possible to retrieve camera pic in background and save the pic every
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What you are asking about is partially possible. I’m going to break your question into a couple parts to answer:
Basically, you can only open the camera and obtain preview frames to save if the
Cameraobject is attached to a validSurfaceHolderto draw with. While this doesn’t technically mean that the surface has to be VISIBLE (i.e. you can draw camera preview frames into aSurfaceViewthat is invisible, I believe), it does mean that there must be a valid surface in a running foreground Activity.If you can live with this, though, you can easily write an application the auto-captures the preview frames every so often with the combination of the
Camera.PreviewCallbackand aHandlercallingpostDelayed()to tell the application when it’s time to capture the next frame. For an example, I’m going to point you at the SDK Guide for Camera, since they provide all the information necessary to access aCamerainstance and register for previews.HTH