can I use the camera occasionally by running my app in the background 24/7 with permission from the user? Does Android currently allow this? I did some research on the internet but I couldn't find a detailed explanation. Thank you.
Edit= I learned that I can run it as a foreground service, but can I guarantee that it will work 24/7?
Nothing in Android works 24/7. The entire OS is built to not allow that. Background services die in 2 minutes or so. Foreground services last longer, but will still eventually be killed by the system (and can always be killed by the user). If you tell us exactly how you want to trigger camera use we may be able to help you structure the app in another way.
Also, using the camera when your app is not in the foreground will require additional permissions. You would need to declare your service as a FOREGROUND_SERVICE_TYPE_CAMERA and follow a few restrictions.