We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
android9/10用的是scoped storage,每个应用存储在自己的子目录下。而Android9以前,应用是共享一个存储子目录。本OSS库不知道scoped storage,而是仍然用共享存储,因此在Android10上出错。以下是关于EXTERNAL_STORAGE的文章
if (android.os.Build.VERSION.SDK_INT < 29) {
// ==> /storage/emulated/0 (Emulator) File dir = Environment.getExternalStorageDirectory();
} else if (android.os.Build.VERSION.SDK_INT >= 29) { // ==> /storage/emulated/0/Android/data/org.o7planning.externalstoragedemo/files File dir = this.getExternalFilesDir(null); } 本库对全部Android版本都仅仅使用了Environment.getExternalStorageDirectory();。这也就是为何在错误信息中显示的是共享路径(Android9以前)的原因。本库的AliOssUploadManager.java和FileUtils.java需要update。或许还有其他的也需要update。 以下是aliyun_oss_react-native下的两个issue:
The text was updated successfully, but these errors were encountered:
the following code change in FileUtils.java works in Android 10 emulator:
FileUtils.java
import android.os.Build; public static String getFilePathFromURI(Context context, Uri contentUri) { //copy file and send new file path String fileName = getFileName(contentUri); if (!TextUtils.isEmpty(fileName)) { File copyFile; if (Build.VERSION.SDK_INT >= 29) { // ==> /storage/emulated/0/Android/data/org.o7planning.externalstoragedemo/files copyFile = new File( context.getExternalFilesDir(null).getAbsolutePath() + File.separator + fileName); } else { copyFile = new File( Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + fileName); } FileUtils.copy(context, contentUri, copyFile); return copyFile.getAbsolutePath(); } return null; }
Sorry, something went wrong.
No branches or pull requests
android9/10用的是scoped storage,每个应用存储在自己的子目录下。而Android9以前,应用是共享一个存储子目录。本OSS库不知道scoped storage,而是仍然用共享存储,因此在Android10上出错。以下是关于EXTERNAL_STORAGE的文章
if (android.os.Build.VERSION.SDK_INT < 29) {
} else if (android.os.Build.VERSION.SDK_INT >= 29) {
// ==> /storage/emulated/0/Android/data/org.o7planning.externalstoragedemo/files
File dir = this.getExternalFilesDir(null);
}
本库对全部Android版本都仅仅使用了Environment.getExternalStorageDirectory();。这也就是为何在错误信息中显示的是共享路径(Android9以前)的原因。本库的AliOssUploadManager.java和FileUtils.java需要update。或许还有其他的也需要update。
以下是aliyun_oss_react-native下的两个issue:
The text was updated successfully, but these errors were encountered: