You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/02/28 10:26:43 UTC
[GitHub] pvillaverde edited a comment on issue #416: Cannot take pictures on
Android
pvillaverde edited a comment on issue #416: Cannot take pictures on Android
URL: https://github.com/apache/cordova-plugin-camera/issues/416#issuecomment-467936409
Hey there!
I'm having the same issue using Ionic. It works when using library but if I try to use the camera it gives the same error.
Here's the code I used:
```javascript
function takePicture(camera) {
const options = {
// quality: 90, //Number Quality of the saved image, range of 0 - 100
destinationType: $cordovaCamera.DestinationType.FILE_URI, //Number Format of the return value
sourceType: camera ? $cordovaCamera.PictureSourceType.CAMERA : $cordovaCamera.PictureSourceType.PHOTOLIBRARY, //Number Set the source of the picture
allowEdit: false, //Boolean Allow simple editing of image before selection
encodingType: $cordovaCamera.EncodingType.JPEG, //Number JPEG = 0, PNG = 1
// targetWidth: 300, //Number Width to scale image (pixels). Used with targetHeight
// targetHeight: 300, //Number Height to scale image (pixels). Used with targetHeight
mediaType: $cordovaCamera.MediaType.PICTURE, //String Set the type of media to select from
cameraDirection: 0, //Number Back = 0, Front-facing = 1
// popoverOptions: "", //String iOS-only options that specify popover location in iPad
saveToPhotoAlbum: true, //Boolean Save image to photo album on the device
correctOrientation: true, //Boolean correct camera captured images in case wrong orientation
};
$cordovaCamera.getPicture(options).then(console.log).catch(console.error);
}
```
Using Ionic v1 and Cordova:
- Ionic Framework : ionic1 1.3.4
- cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
- Cordova Platforms : android 7.1.4
- cordova-plugin-camera 4.0.3 "Camera"
- Tested on device: Android 7.1.1 on Motorola G4Play
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org