You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Bob Myers (JIRA)" <ji...@apache.org> on 2018/01/16 06:06:00 UTC

[jira] [Resolved] (CB-13773) camera.getPicture returns error code 20

     [ https://issues.apache.org/jira/browse/CB-13773?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bob Myers resolved CB-13773.
----------------------------
    Resolution: Cannot Reproduce

> 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-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org