Android QR Code Scanner is an Android App is written in Java that uses the Android Jetpack CameraX library for previewing the camera and image analysis along with the ZXing open-source bar code scanning library.
The code actually crashes when the permission of accessing the camera is already given. The following functions solved that issue for me. Please make a check before requesting a camera in the onCreate function.
private boolean isCameraPermissionGranted(){
int selfPermission= ContextCompat.checkSelfPermission(getBaseContext(), Manifest.permission.CAMERA);
return selfPermission==PackageManager.PERMISSION_GRANTED;
}
Moving from Sony Xperia with Android 8 where it worked perfectly to OnePlus with Android 10 it stopped working. The app still display's the preview but never seems to recognize a QR code.
QR Code Found never seems to be visible it never seems to be able to scan anything if using huawei mobile with 8 api i didnt try emualtor as in guide but it should work on mobile too right ?