Joh*_*ner 2 camera android cordova
我需要使用Phonegap应用程序捕获图像.在iOS上一切正常但在Android上(通过Phonegap Build)它会在"Error capture image"时抛出错误.
我在config.xml中添加了以下行,但这并没有改变任何内容:
<feature name="Camera">
<param name="android-package" value="org.apache.cordova.camera.CameraLauncher" />
</feature>
<feature name="http://api.phonegap.com/1.0/device" />
<feature name="http://api.phonegap.com/1.0/camera" />
<feature name="http://api.phonegap.com/1.0/file" />
<feature name="http://api.phonegap.com/1.0/media" />
<feature name="http://api.phonegap.com/1.0/network" />
Run Code Online (Sandbox Code Playgroud)
我的API调用看起来像这样:
$(document).on('click', '#cameraPreview', function() {
pictureSource = navigator.camera.PictureSourceType;
destinationType = navigator.camera.DestinationType;
navigator.camera.getPicture(onGetPictureSuccess, onGetPictureFail, {
quality: 40,
sourceType: Camera.PictureSourceType.CAMERA,
destinationType: Camera.DestinationType.FILE_URI,
allowEdit: true,
encodingType: Camera.EncodingType.JPG,
targetWidth: 1000,
targetHeight: 1000,
saveToPhotoAlbum: true,
correctOrientation: 1
});
});
Run Code Online (Sandbox Code Playgroud)
我使用Phonegap 3.7和Phonegap Build.
Joh*_*ner 19
好的,现在我知道了答案.问题是saveToPhotoAlbum: true选择.Android无法识别这一点.当我删除此选项时一切正常.
| 归档时间: |
|
| 查看次数: |
2962 次 |
| 最近记录: |