I am developing an application which will be able to record video from background of application by using Service
.
Problem description :
In my application recording will be scheduled. If user want to record video from 1 PM to 3 PM, he will schedule the task and can exit from application. Application will automatically start recording at 1PM to 3PM.
What I did yet :
I googled about my query but didn't get solution. Many articles say that it is not possible. But in Google Play there are some applications (for eg MyCar Recorder) which can record video from background of application.
I got an article about same but its not working.
What is the way to implement this functionality?
1- I have created a activity to start service like this:
2 - Now I have created a service to record the video in background like this:
It will create a file video.mp4 in your sd card. you may change the code for adding more functionality but the basic functionality is achieved through this code i.e. record video in background.
NOTE: i have started the service through button click in activity but you can start it through any other way also like broadcastreceiver etc.
Hope it helps!! Cheers.
Yes, you can record the background video like this:
First, create a video app using service. Do not set its view so that it will not be visible. If you are doing it in service then that is better because...
Second, you can use the AlarmManager for setting the alarm of particular time and then at that time, by using intent, start your service again. For stopping your app you can use AlarmManager, as well.