I have images in external storage in Orders folder and that image i am trying to share to external apps using 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) {
}
I have given storage permission on loading application itself but i get every time app crashes
ndroid.os.FileUriExposedException: file:///storage/emulated/0/Orders/OrderID.jpg exposed beyond app through ClipData.Item.getUri()
Can any one help me how i cant fix this ? i have followed many post in google but no use
android.os.FileUriExposedException: file.jpg exposed beyond app through ClipData.Item.getUri()
https://github.com/react-native-community/react-native-share/issues/185