capacitor-community / barcode-scanner

A fast and efficient (QR) barcode scanner for Capacitor
MIT License
437 stars 167 forks source link

What does startScanning() do and how to implement it? #286

Open SebastianJurupe opened 1 year ago

SebastianJurupe commented 1 year ago

I'm having a problem when implementing startScaning(), it's supposed to run the sccanner several times right?

noberumotto commented 9 months ago
const startScan = async () => {
  // Check camera permission
  // This is just a simple example, check out the better checks below
  await BarcodeScanner.checkPermission({ force: true });

  // make background of WebView transparent
  // note: if you are using ionic this might not be enough, check below
  // BarcodeScanner.hideBackground();

  await BarcodeScanner.startScanning(undefined, async (result) => {
    if (result.hasContent) {
      console.log(result.content); // log the raw scanned content
    }
    await BarcodeScanner.resumeScanning();
  });
};