繁体   English   中英

Ionic Cordova-Plug-Camera无法在Android上打开图库

[英]Ionic cordova-plugin-camera not opening gallery on Android

我试图让用户在我的离子本机应用程序上从图库中选择图像,代码在IOS上有效,但在Android上,当选择“选择图像”时,什么都没发生,在logcat上看不到错误。

我的方法:

accessGallery(){
    this.camera.getPicture({
      sourceType: this.camera.PictureSourceType. SAVEDPHOTOALBUM,
      destinationType: this.camera.DestinationType.DATA_URL,
      quality: 10
     }).then((imageData) => {
        this.sanitizeImage('data:image/jpeg;base64,' + imageData);
      }, (err) => {
       console.log(err);
       this.showAlert("Cannot Access Gallery", err);
     });
   }

任何帮助或建议,将不胜感激。

这在Android中对我有效。

 const options: CameraOptions = {
    quality: 10
    , destinationType: this.camera.DestinationType.DATA_URL
    , mediaType: this.camera.MediaType.PICTURE // Try this
    , sourceType: this.camera.PictureSourceType.PHOTOLIBRARY
 };

唯一的区别是,得到结果后,我不对文本进行消毒。
我只是这样做this.myPicture = image64;

尝试一下,告诉我如何进行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM