I work on XSCamera , a background video recorder for Android. It records with the screen off or while you use another app. It has a bit over 6 million installs, which mostly means we get to find every edge case in production.
People regularly ask whether this kind of app is "still possible" on new Android versions. It is. But the list of things you must do correctly gets longer every year, and the failure mode is nasty: the app installs, the button works, and the recording silently never starts or dies ten minutes in.
This is the short version of what we've learned. If you're building anything that holds the camera or microphone while the user is elsewhere (a dashcam, a baby monitor, a bodycam for cyclists), most of it applies to you.
The rules, by version
Android 9 cut off camera and microphone access for apps that are idle in the background. From here on you need a foreground service, and a foreground service means a notification.…