Hello,
I'm using ZXingScannerView in my app. When I push the button which opens the page containing that control a popup appears asking for camera permissions (Camera permissions are set in the visual studio project file for the android app).
When I accept the permissions everything runs fine, but when I deny it the app crashes with an UnauthorizedAccessException.
On the page I simply added the control:
<qr:ZXingScannerView x:Name="ScannerView" HorizontalOptions="FillAndExpand" OnScanResult="HandleScannerOnResultEvent" VerticalOptions="FillAndExpand" />
In the MainActivity.OnCreate I'm doing the following:
Platform.Init(); MobileBarcodeScanner.Initialize(Application);
and also in the MainActivity:
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults) { PermissionsHandler.OnRequestPermissionsResult(requestCode, permissions, grantResults); }
The last lines of the call stack are:
01-09 11:15:58.521 D/ZXing.Net.Mobile( 3973): System.NullReferenceException: Object reference not set to an instance of an object.
01-09 11:15:58.521 D/ZXing.Net.Mobile( 3973): at ZXing.Mobile.CameraAccess.CameraController.RefreshCamera () [0x0001e] in <819b29aa6d91462699e19a679be55a44>:0
I'm using ZXing v2.4.1.
Android: several phones and tablets running Android version 6.0.1 and 8.0
Have I missed something in my implementation? Since the ScannerView control forces the popup and waits for the result as well I'm expecting that it will be handled there. Or do I have to do the check in advance before instantiating the control? But the projects main page says that ZXing handles the permission request for me.
Hello,
I'm using ZXingScannerView in my app. When I push the button which opens the page containing that control a popup appears asking for camera permissions (Camera permissions are set in the visual studio project file for the android app).
When I accept the permissions everything runs fine, but when I deny it the app crashes with an UnauthorizedAccessException.
On the page I simply added the control:
<qr:ZXingScannerView x:Name="ScannerView" HorizontalOptions="FillAndExpand" OnScanResult="HandleScannerOnResultEvent" VerticalOptions="FillAndExpand" />In the
MainActivity.OnCreateI'm doing the following:Platform.Init(); MobileBarcodeScanner.Initialize(Application);and also in the
MainActivity:public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults) { PermissionsHandler.OnRequestPermissionsResult(requestCode, permissions, grantResults); }The last lines of the call stack are:
01-09 11:15:58.521 D/ZXing.Net.Mobile( 3973): System.NullReferenceException: Object reference not set to an instance of an object.
01-09 11:15:58.521 D/ZXing.Net.Mobile( 3973): at ZXing.Mobile.CameraAccess.CameraController.RefreshCamera () [0x0001e] in <819b29aa6d91462699e19a679be55a44>:0
I'm using ZXing v2.4.1.
Android: several phones and tablets running Android version 6.0.1 and 8.0
Have I missed something in my implementation? Since the ScannerView control forces the popup and waits for the result as well I'm expecting that it will be handled there. Or do I have to do the check in advance before instantiating the control? But the projects main page says that ZXing handles the permission request for me.