Hello,
Welcome to Microsoft Q&A!
On Android 9 (API level 28)
and later, apps running in the background cannot access the camera
. Therefore, you should use the camera either when your app is in the foreground or as part of a foreground service
.
For foreground service
please check here .
If your app targets Android 11 (API level 30)
or higher and accesses the camera in a foreground service, declare the camera
foreground service types, as attributes of your <service>
component.
<manifest>
...
<service ... android:foregroundServiceType="camera" />
</manifest>
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.