I also having the same problem when running on android studio
[Barcode Scanner error: Error: BarcodeScanner.checkPermission() is not implemented on android]
here is my implementation,
methods: {
async startScan() {
try {
// Check camera permission
await BarcodeScanner.checkPermission({ force: true });
// Make background of WebView transparent
BarcodeScanner.hideBackground();
const result = await BarcodeScanner.startScan();
// If the result has content
if (result.hasContent) {
console.log(result.content);
// You can process the scanned content as per your requirements
// For example, you can display it on the screen or send it to a server.
}
} catch (error) {
console.error("Barcode Scanner error:", error);
}
},
However , it works well on webview via ionic serve. The camera get accessed smoothly and scan work nicely.
*I have disable the checkPermission() line , but it comes out with new error for scan
Sending plugin error: {"save":false,"callbackId":"4461136","pluginId":"BarcodeScanner","methodName":"startScan","success":false,"error":{"message":"Attempt to invoke virtual method 'void androidx.camera.view.PreviewView.setScaleType(androidx.camera.view.PreviewView$ScaleType)' on a null object reference"}}
I also having the same problem when running on android studio
[Barcode Scanner error: Error: BarcodeScanner.checkPermission() is not implemented on android]
here is my implementation,
However , it works well on webview via ionic serve. The camera get accessed smoothly and scan work nicely.
*I have disable the checkPermission() line , but it comes out with new error for scan
Sending plugin error: {"save":false,"callbackId":"4461136","pluginId":"BarcodeScanner","methodName":"startScan","success":false,"error":{"message":"Attempt to invoke virtual method 'void androidx.camera.view.PreviewView.setScaleType(androidx.camera.view.PreviewView$ScaleType)' on a null object reference"}}