Skip to content

After taking a picture, I get an error 'cancelled' #225

@butaminas

Description

@butaminas

Which platform(s) does your issue occur on?

  • Android
  • 10.0
  • emulator. Pixel 3a

I'm developing an app on nativescript-vue and using this particular package on a onShowFileChooser event by extending the WebChromeClient.

The idea is to make the camera to show when clicking a <input type='file' /> button on a webview.

First of all, I request user permissions on load like this:

mounted() {
            requestPermissions()
},

Then on the onShowFileChooser I do something like this:

onShowFileChooser: function (WebView, ValueCallback, FileChooserParams) {
                        camera.takePicture()
                            .then(function (imageAsset) {
                                console.log("Result is an image asset instance");
                                var image = new Image();
                                image.src = imageAsset;                               
                            }).catch(function (err) {
                            console.log("Error -> " + err.message);
                        });

Whenever I click the file input field in a webview the camera app appears and I can take a picture. After taking the picture and clicking the check mark to confirm, I get back to my app but in the console, I see:

'Error -> cancelled'

I've tried solution, mentioned here but this wasn't the case.

Why do I get this error?
Besides that, anyone has any idea how to actually return the image to the input field?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions