【问题标题】:Ionic cordova-plugin-camera not opening gallery on AndroidIonic cordova-plugin-camera 未在 Android 上打开图库
【发布时间】:2019-02-28 20:15:20
【问题描述】:

我正在尝试让用户从我的离子原生应用程序上选择图像,代码在iOS上工作,但在Android时选择选择oply oply oply mode,无法在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 ionic3 cordova-plugin-camera


    【解决方案1】:

    这适用于我在 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;

    试试看,告诉我结果如何。

    【讨论】:

    • 谢谢..我让它工作了,问题是插件,当我删除插件时它工作了。
    猜你喜欢
    • 2016-10-06
    • 2018-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-07
    • 1970-01-01
    • 1970-01-01
    • 2019-07-10
    相关资源
    最近更新 更多