Prevent black screen when trying to scan a QR code in assistant right after granting the app the CAMERA permission (on some devices)

This commit is contained in:
Sylvain Berfini 2025-10-14 14:23:41 +02:00
parent 94d6584213
commit 58295401ef

View file

@ -118,6 +118,10 @@ class QrCodeViewModel
@UiThread
fun setBackCamera() {
coreContext.postOnCoreThread { core ->
// Just in case, on some devices such as Xiaomi Redmi Note 5
// this is required right after granting the CAMERA permission
core.reloadVideoDevices()
for (camera in core.videoDevicesList) {
if (camera.contains("Back")) {
Log.i("$TAG Found back facing camera [$camera], using it")