MaterialBarcodeScanner icon indicating copy to clipboard operation
MaterialBarcodeScanner copied to clipboard

Scanning not started after granting permission

Open xabaras opened this issue 8 years ago • 2 comments

First time I try to scan a barcode MaterialBarcodeScanner asks for camera permission, this is correct, but after the user has granted the permission nothing happens, scanning doesn't get started and the user has to tap in the button calling startScan() again. Is it a bug or the app has to handle the onRequestPermissionsResult callback on its own?

xabaras avatar Jan 26 '17 09:01 xabaras

I did a workaround to do this. But I'll send a Pull Request to fix this.

//TODO WORKAROUND TO START LIB AFTER PERMISSION. @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (requestCode ==2 && grantResults[0] == PackageManager.PERMISSION_GRANTED){ //TODO START SCAN AGAIN } super.onRequestPermissionsResult(requestCode, permissions, grantResults); }

uziassantosferreira avatar May 30 '17 17:05 uziassantosferreira

There is some example code

https://github.com/EdwardvanRaak/MaterialBarcodeScanner/blob/master/app/src/main/java/com/edwardvanraak/materialbarcodescannerexample/MainActivity.java

benoffi7 avatar Jun 07 '17 15:06 benoffi7