diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index 914eec5..849e875 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1,4 +1,15 @@ + + + + + \ No newline at end of file diff --git a/android/src/main/java/com/chirag/RNMail/RNMailModule.java b/android/src/main/java/com/chirag/RNMail/RNMailModule.java index 658ce6a..493a439 100644 --- a/android/src/main/java/com/chirag/RNMail/RNMailModule.java +++ b/android/src/main/java/com/chirag/RNMail/RNMailModule.java @@ -5,6 +5,7 @@ import android.content.pm.ResolveInfo; import android.net.Uri; import android.text.Html; +import android.support.v4.content.FileProvider; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; @@ -89,7 +90,10 @@ public void mail(ReadableMap options, Callback callback) { if (attachment.hasKey("path") && !attachment.isNull("path")) { String path = attachment.getString("path"); File file = new File(path); - Uri p = Uri.fromFile(file); + Uri p = FileProvider.getUriForFile( + reactContext, + reactContext.getApplicationContext() + .getPackageName() + ".provider", file); i.putExtra(Intent.EXTRA_STREAM, p); } } diff --git a/android/src/main/res/xml/provider_paths.xml b/android/src/main/res/xml/provider_paths.xml new file mode 100644 index 0000000..61248eb --- /dev/null +++ b/android/src/main/res/xml/provider_paths.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file