【发布时间】:2019-01-05 20:34:04
【问题描述】:
我在 Orders 文件夹的外部存储中有图像,并且我正在尝试使用 Intent 将图像共享给外部应用程序
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/Orders");
String filename = "OrderID.jpg";
File file = new File(file,filename);
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("image/*");
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.putExtra(Intent.EXTRA_STREAM,Uri.fromFile(file));
try {
startActivity(intent);
} catch (android.content.ActivityNotFoundException ex) {
}
我已授予加载应用程序本身的存储权限,但每次应用程序崩溃时我都会获得权限
ndroid.os.FileUriExposedException: file:///storage/emulated/0/Orders/OrderID.jpg exposed beyond app through ClipData.Item.getUri()
谁能帮我解决这个问题? 我在谷歌上关注了很多帖子,但没有用
android.os.FileUriExposedException: file.jpg exposed beyond app through ClipData.Item.getUri()
https://github.com/react-native-community/react-native-share/issues/185
【问题讨论】:
-
检查答案。
标签: android