TakePhoto icon indicating copy to clipboard operation
TakePhoto copied to clipboard

Android 10不兼容

Open chenyabingsuny opened this issue 4 years ago • 6 comments

不兼容Android10 沙盒访问 拍照 相册选择都不兼容

chenyabingsuny avatar Sep 10 '19 01:09 chenyabingsuny

Android Q不是没有沙盒特性了

IDBAI avatar Sep 10 '19 02:09 IDBAI

Android Q不是没有沙盒特性了

有,现在禁止访问root目录,只能访问应用目录

chenyabingsuny avatar Sep 10 '19 03:09 chenyabingsuny

。。。

systemChina avatar Sep 26 '19 09:09 systemChina

TUriParse 文件目录改到应用目录下 否则没有权限

/** * 获取一个临时的Uri, 文件名随机生成 * * @param context * @return */ public static Uri getTempUri(Context context) { String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date());

    File file = new File(context.getExternalFilesDir(Environment.DIRECTORY_PICTURES), "/temp/" + timeStamp + ".jpg");

    if (!file.getParentFile().exists()) {
        file.getParentFile().mkdirs();
    }
    return getUriForFile(context, file);
}

zhangyongfa888 avatar Oct 30 '19 01:10 zhangyongfa888

@chenyabingsuny 请问下 我手机android10 拍照的时候 设置了裁剪options 然后直接走到了takeCancel android8的时候能正常裁剪并且拿到图片

rcj60560 avatar Nov 07 '19 08:11 rcj60560

临时解决方案

<application android:name=".app.MyApplication" android:allowBackup="true" android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher_logo" android:label="@string/app_name" android:largeHeap="true" android:networkSecurityConfig="@xml/network_security_config" android:roundIcon="@mipmap/ic_launcher_logo" android:supportsRtl="true" android:theme="@style/AppTheme" android:requestLegacyExternalStorage="true"> //Android10 使用旧的存储策略

wds1181977 avatar Nov 25 '19 03:11 wds1181977