Take a picture on background service android (Camera and Camera2)

812 views Asked by At

I want to take a picture each minute without start camera activity and save it on the device storage, how I can start and use the camera on a background service...

1

There are 1 answers

0
Simon On

You can extend Service Make connection to camera You can make Tier that will make photo from some time.

    public class CameraPhoto extends Service {

        @Override
        public void onCreate() {
            super.onCreate();
            Timer timer = new Timer();
            timer.schedule(new UpdateTimeTask(), 0, 1800000); //тикаем каждые 30 мinute без задержки 
        }
        //задача для таймера

        class UpdateTimeTask extends TimerTask {
            public void run() {
//Here write what you want do . You can call method here, or make manipulation with camera
                }
            }