From dd4cb23005f66f2e3933fbc2eb62da6d5a762ed5 Mon Sep 17 00:00:00 2001 From: wb9688 Date: Wed, 13 May 2020 09:42:08 +0200 Subject: [PATCH] Fix sending e-mail from crash reporter --- .../java/org/schabi/newpipe/report/ErrorActivity.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java b/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java index e1fd9d1d4..358c17ad4 100644 --- a/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java +++ b/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java @@ -229,12 +229,15 @@ public class ErrorActivity extends AppCompatActivity { context.startActivity(webIntent); }) .setPositiveButton(R.string.accept, (dialog, which) -> { - Intent i = new Intent(Intent.ACTION_SENDTO); - i.setData(Uri.parse("mailto:" + ERROR_EMAIL_ADDRESS)) + final Intent i = new Intent(Intent.ACTION_SENDTO) + .setData(Uri.parse("mailto:")) // only email apps should handle this + .putExtra(Intent.EXTRA_EMAIL, new String[]{ERROR_EMAIL_ADDRESS}) .putExtra(Intent.EXTRA_SUBJECT, ERROR_EMAIL_SUBJECT) .putExtra(Intent.EXTRA_TEXT, buildJson()); + if (i.resolveActivity(getPackageManager()) != null) { + startActivity(i); + } - startActivity(Intent.createChooser(i, "Send Email")); }) .setNegativeButton(R.string.decline, (dialog, which) -> { // do nothing