[ https://issues.apache.org/jira/browse/CB-13773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16326791#comment-16326791 ]
Bob Myers commented on CB-13773: -------------------------------- [~bowserj] Thanks. This problem magically went away. We'll close it. > camera.getPicture returns error code 20 > --------------------------------------- > > Key: CB-13773 > URL: https://issues.apache.org/jira/browse/CB-13773 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-plugin-camera > Environment: Android platform > Reporter: Bob Myers > Priority: Major > > A call to `camera.getPicture` returns an error code of "20". This occurs on > the Android platform. Things work fine on the browser platform. > This error started suddenly a few days ago, and I cannot identify anything > specific I did that might have caused it. > It's very hard for me to present a reproducible case, since this is occurring > in the context of large app, but I will try to reproduce in a sample app if > there's no alternative. Meanwhile, I'm posting this issue in the hope that > someone might know what an error 20 is supposed to mean. > In case it matters, it strikes me as odd that the device is not asking me for > access for the camera when I install the app, nor when I try to take the > first picture. > This happens on different devices, including Nougat and Oreo. It happens with > different versions of the camera plugins. What is especially puzzling to me > is that it happens with a build of my app from a version three months ago, > even though that application works fine in the field. > cordova-android version is 6.2.1. Cordova CLI version is 8.0.0. > Here is some relevant code: > {code} > function getPicture(cameraOptions: CameraOptions): Promise<string> { > const {camera} = navigator; > if (!camera) throw new Error("missing camera in > cordova-plugin-camera.util"); > return new Promise((resolve, reject) => camera.getPicture(resolve, reject, > cameraOptions)); > } > // Get a picture from the camera, returning a promise for the URL on the > device. > private async getPictureCordova(library): Promise<string> { > const destinationType = isPlatformWindows() ? > Camera.DestinationType.DATA_URL : Camera.DestinationType.FILE_URI; > const sourceType = library ? Camera.PictureSourceType.PHOTOLIBRARY : > Camera.PictureSourceType.CAMERA; > const cameraOptions: CameraOptions = { > quality: 50, > destinationType, > sourceType, > allowEdit : false, > targetWidth: 1280, > // targetHeight: 960, > correctOrientation: true, > saveToPhotoAlbum: false, > mediaType: Camera.MediaType.PICTURE, // applies only in case of > library > }; > this.reset(); > return await getPicture(cameraOptions); > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org