#my qr-code scanner aint working

10 messages · Page 1 of 1 (latest)

flat drum
#

https://www.npmjs.com/package/@capacitor-community/barcode-scanner/v/5.0.0-beta.1
i am using ionic angular(i know this is just an angular discord server)
here is the code:

import { BarcodeScanner } from "@capacitor-community/barcode-scanner";

  ngOnInit() {
    this.startScanning()
  }

  async checkPermission() {
    return new Promise(async (resolve, reject) => {
      const status = await BarcodeScanner.checkPermission({force: true})
      if (status.granted) {
        resolve(true)
      } else if(status.denied) {
        BarcodeScanner.openAppSettings();
        resolve(false)
      }
    })
  }

  async startScanning() {
    const isAllowed = await this.checkPermission()

    if (isAllowed) {
      BarcodeScanner.hideBackground();

      const result = await BarcodeScanner.startScan()

      if(result.hasContent) {
        this.scannedValue = result.content
        console.log(this.scannedValue)
        BarcodeScanner.stopScan()
      } else {
        console.error('No content found')
      }
    }
  }

nothing is being console logged

violet dagger
violet dagger
# flat drum so it is not usable anymore?

Except if you have some specific motivation to use a deprecated lib with an archived GitHub repo, i'd see no reason to invest some time at trying to make it work as there is an alternative.

#

Even if you manage to make it work, you might face a broken change in Capacitor some day as it's not maintained anymore

flat drum
#

my problem is that i was using @capacitor/barcode-scanner and i had an issue with that. here is the image

#

this appeared only on apple devices but not on windows devices

#

in our older apps we are using capacitor-comunity/barcode scanner so thats the reason why i wanted to try it in this app. but i will have to stick to that capacitor/barcode-scanner

flat drum
violet dagger