Closed salazarbarrera closed 2 years ago
The same code was tested in a vanilla Android 11 (Nokia 7.2 up to date, light mode) with WebView 104.0.5112.97.
Same results.
@salazarbarrera you are not requesting permission to the camera. Without camera permission the plugin will never be able to display something ;)
Check the docs for permission "best-practice-stuff", the easiest way for testing is to add await BarcodeScanner.checkPermission({ force: true });
before calling await BarcodeScanner.startScan()
, but you should implement better checks based on the state of course :)
After adding the check it worked without any issues on my device.
Oooh, I thought it was enough to declare the camera permission in the manifest, I didn't notice that part.
This solves the issue. I'll fix and complete my example and let it stay among my repos so others can use it in case they find this issue via search engines. Thanks for your help.
Before I close the the issue, and knowing this is getting off-topic, should BarcodeScanner.enableTorch() turn on the flashlight? It changes the state shown by getTorchState(), but it doesn't seem to do anything yet (despite this PR #78).
It should yes, and at least on my device it does so as well...
Unfortunately I have no other device to test it with, but on my android and iOS devices it works as expected :)
I'll open another issue about that when I modify the code after work. About this matter, the problem is solved.
Describe the bug I can't find the scanner in the DOM. I followed the advice to manually hide certain objects as it was suggested by other users but it didn't work. I also tried to start BarcodeScanner from
app.component.ts
, unsuccessfully.You can see an example project here.
To Reproduce
$ ionic cap run android
and select the target device. Alternatively you can compile, install and run it with Android Studio after executing$ ionic cap add android
.Expected behavior At least the BarcodeScanner should appear in the DOM.
Version v3.0.0
Smartphone