I am using camera to take pictures in the foreground service, which can be used long term like 5 to 10 hours. The problem is when another app starts using camera while the foreground service is running it stop taking pictures and user have to manually restart the service.
I am taking pictures in a loop ( I initializes the camera instance takes a picture then releases the camera and repeat). The solution I see here, is that at the start of each loop iteration I should add a check to see if the camera is currently in use.
How exactly can I check if the camera is in use by any other application or process on device? or is there a better approach to my problem?
This worked for me!!
if returns true, means camera is free