startScan() doesn't open native camera
See original GitHub issueDescribe the bug I installed this plugin on Ionic 5 Angular iOS project. Whenever I run startScan method, it doesn’t trigger native camera and no error message. The only thing I can see in log is this
⚡️ To Native -> BarcodeScanner hideBackground 7747052
⚡️ To Native -> BarcodeScanner startScan 7747053
To Reproduce Steps to reproduce the behavior:
-
Follow install plugin instruction at readme
-
Import Plugins
import { Plugins } from '@capacitor/core';
-
Put prepare on ionViewWillEnter()
-
Create wrapper function to call startScan method.
async openBarcodeScanner() {
const { BarcodeScanner } = Plugins;
BarcodeScanner.hideBackground();
try {
const barcodeData = await BarcodeScanner.startScan()
console.log('Barcode data', barcodeData);
if(barcodeData.hasContent) {
this.checkBarcode(barcodeData.content);
}
} catch (err) {
console.log('Scan barcode error', err);
}
}
- Edit info.plist, set camera usage description
- Ionic build, sync, then open ios
Expected behavior When startScan method get called, screen should immediately navigate to native camera.
Smartphone (please complete the following information):
- Device: iPhone 6
- OS: iOS 12.4.9
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11 (5 by maintainers)
Top Results From Across the Web
QR Scanner: Seems to be working in the background, but ...
The QR Scanner seems to be working in the background but doesn't display a preview when calling show(). The code for the QR...
Read more >Android - Why am I getting a black camera screen?
If you are running an Android app on a device and the camera screen is black or it ... Check that the startScanning()...
Read more >BluetoothLeScanner - Android Developers
Use BluetoothAdapter#getBluetoothLeScanner() to get an instance of BluetoothLeScanner . ... it has to be the same instance as the one used to start...
Read more >@capacitor-community/barcode-scanner - npm
After startScan() is resolved, the Scanner View will be automatically destroyed to save battery. But if you want to cancel the scan before ......
Read more >Native Camera returned opening error "Cannot Initialise ...
1. If, after reboot, you sometimes cannot connect the default camera app to front camera, this is most likely a hardware problem. ·...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@eryzerz @bash88 @herefishyfish
I am delighted to announce that I just released a version with permission utils added.
You can install it by running:
Documentation can be found here: https://github.com/DutchConcepts/capacitor-barcode-scanner/tree/main#permissions
I am inviting you guys to test it out and share some feedback
Hm, I see now. Hold on tight as I will release a solution for this in a couple of days. In the meantime you could request permission with this plugin for example: https://www.npmjs.com/package/capacitor-plugin-permissions