I'm trying to get access to the camera while the app is in the background (e.g. the phone is locked). As it turns out, Android 9 does not allow to do that unless you are trying to get access using a foreground service. I'm using ionic framework in my application (camera is being accessed using navigator
interface). Is there any way to run JS from the foreground service using native plugins or by any other means?
Asked
Active
Viewed 472 times
2

Vasniktel
- 307
- 1
- 4
- 12
-
The only js allowed to run in the background is via a registered service worker. But since service worker as a ~web worker has no access to "window" etc, most likely you can't establish native plugin to js bridge there. But interesting problem;) – Sergey Rudenko May 05 '20 at 18:15