Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Error checkPermission() was not implemented by android #277

Open
kacangdankawan opened this issue Jul 31, 2023 · 2 comments
Open

Error checkPermission() was not implemented by android #277

kacangdankawan opened this issue Jul 31, 2023 · 2 comments

Comments

@kacangdankawan
Copy link

kacangdankawan commented Jul 31, 2023

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"}}

@rateltechcom
Copy link

I have same problem. Are there any solutions?

@mrivera24
Copy link

I have a similar problem. In android doesnt request the permissions, is deny by default. Any solution? Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants