Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants