Merge pull request #469 from lbryio/send-log-android6

fix send log error on devices running Android 6 and lower
This commit is contained in:
Akinwale Ariwodola 2019-03-09 08:41:14 +01:00 committed by GitHub
commit bb8d856d17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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);