For scientific measurements, I would like to access the camera frames from a service. The idea is to analyze the images coming from the camera in real-time under some conditions. Since the phone might be restarted or simply locked, it should be possible to start the process from a service.
For now, I was satisfied by using a Camera.Callback and the onPreviewFrame callback, but it appears that it only works if my application is running in foreground. More precisely, the camera requires a valid SurfaceView in order to call the onPreviewFrame function. And a SurfaceView created in an Activity is destroyed when the activity is minimized / finished.
I just cannot find a way to get the frames from a background process. Actually, it works on a Galaxy Note 10.1, but the Galaxy S4 requires a valid SurfaceView.
Is there a way to achieve this?
There are many topics about this on StackOverflow, but none worked for me.
