Ionic 画廊打开在Android移动的使用CameraSource.照片离子电容器

3df52oht  于 2023-03-06  发布在  Ionic
关注(0)|答案(1)|浏览(155)

下面的代码在网络浏览器(普华永道)中打开图库,工作正常,但在Android设备上运行相同的图片库,它不会打开。请让我知道,如果我错过了什么。

import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';

   async openCamera(){
    
    if (this.imagesend.length <= 1) {
    
    const image = await Camera.getPhoto({
        quality: 90,
        allowEditing: false,
        correctOrientation: true,
        resultType: CameraResultType.Base64, 
              
       source: CameraSource.Photos
      
        
      });
  this.imagesend.push(image.base64String);
  this.base64Image.push("data:image/jpeg;base64," + image.base64String);
}
else{
  let msg = "You can only upload two images.";
      this.presentErrorToast(msg); 
}
}
zf2sa74q

zf2sa74q1#

抱歉,我忘记在AndroidManifest.xml中添加权限

相关问题