3

I have a requirement in android application where i want to turn off screen when no motion has been detected(Motion detection is done using camera).

But the camera should be running in background and taking pictures while the screen is off and as soon as the motion is detected then the screen should be turned on.

How can i do that in android?

I have searched a lot and implemented few things but could not achieve the desired result.

Please help me out.

Sanober Malik
  • 2,765
  • 23
  • 30

1 Answers1

0

I don't think this is possible. To take a picture the Camera class needs the SurfaceHolder and it needs to draw the frame on the screen for the capture to work.

JanithaR
  • 1,094
  • 2
  • 11
  • 23
  • But i am taking the pictures without showing the preview i am using PictureCallback. – Sanober Malik Feb 20 '13 at 11:04
  • You mean you're taking pictures using some other way other than explained [here](https://developer.android.com/reference/android/hardware/Camera.html) under `To take pictures with this class, use the following steps`? – JanithaR Feb 20 '13 at 11:11
  • yes. I am not using preview. I am capturing image using front camera and that image is returned as byte array to class implementing PictureCallback. – Sanober Malik Feb 20 '13 at 11:16
  • OK so if that's implemented then you only have to deal with motion control. :) @Rajnikant 's answer should help. – JanithaR Feb 20 '13 at 11:42