I want to detect the numbers of faces in the front camera frame. I can detect the face once I get the image using this :http://www.developer.com/ws/android/programming/face-detection-with-android-apis.html. But I don't know how to capture an image using the front camera every 30 seconds without an user interaction.Can someone please help me?
Following code will capture photo from your camera after every 5 secs.
if (TIMER_STARTED) {
multishotTimer.cancel();
multishotTimer.purge();
TIMER_STARTED = false;
} else {
multishotTimer = new Timer();
multishotTimer.schedule(new TimerTask() {
@Override
public void run() {
TIMER_STARTED = true;
Camera camera = surfaceView.getCamera();
camera.takePicture(null, null,
new HandlePictureStorage());
}
}, 1000, 5000L);
}
Here, TIMER_STARTED is boolean which indicate whether timer is running or not.
Following is code for HandlePictureStorage
private class HandlePictureStorage implements PictureCallback {
@Override
public void onPictureTaken(byte[] picture, final Camera camera) {
//do something when picture is captured...
}
}