BGAQRCode-Android icon indicating copy to clipboard operation
BGAQRCode-Android copied to clipboard

targetSdkVersion29在Android 10手机识别本地相册二维码返回null

Open harveyhui opened this issue 4 years ago • 5 comments

targetSdkVersion29在Android 10手机识别本地相册二维码返回null,同时相册打开也是看不到图片。

harveyhui avatar Jun 12 '20 03:06 harveyhui

管理分区外部存储访问

<manifest ... >
  <!-- This attribute is "false" by default on apps targeting
       Android 10 or higher. -->
  <application android:requestLegacyExternalStorage="true" ... >
    ...
  </application>
</manifest>

yanzhonghui avatar Jun 18 '20 03:06 yanzhonghui

同理,我也遇到这样的问题

Jay-ch avatar Jul 14 '20 01:07 Jay-ch

10.0扫描相册为null

zuijiusi avatar Sep 23 '20 05:09 zuijiusi

我的也是,开始以为我的二维码有问题 ,但是我拍了很多张都是这样

CotTan avatar Sep 27 '20 03:09 CotTan

原因是cn.bingoogolapple.qrcode.core.BGAQRCodeUtil中public static Bitmap getDecodeAbleBitmap(String picturePath)方法内部对图片进行了压缩,导致失败失败,可以将下面int sampleSize = options.outHeight / 400;中sampleSize值改小点就可以了 public static Bitmap getDecodeAbleBitmap(String picturePath) { try { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(picturePath, options); int sampleSize = options.outHeight / 400; if (sampleSize <= 0) { sampleSize = 1; } options.inSampleSize = sampleSize; options.inJustDecodeBounds = false;

        return BitmapFactory.decodeFile(picturePath, options);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

Henry519 avatar Jan 29 '21 09:01 Henry519