fix send log error on devices running Android 6 and lower

This commit is contained in:
Akinwale Ariwodola 2019-03-08 17:23:09 +01:00
parent 32b128fe40
commit 42075291ce

View file

@ -186,6 +186,10 @@ public class UtilityModule extends ReactContextBaseJavaModule {
if (fileUri != null) { if (fileUri != null) {
Intent shareIntent = new Intent(); Intent shareIntent = new Intent();
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
// Android 6 and lower
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
shareIntent.setAction(Intent.ACTION_SEND); shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("text/plain"); shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_STREAM, fileUri); shareIntent.putExtra(Intent.EXTRA_STREAM, fileUri);