Fix crash when opening URL:s in Android < 7.0

In versions of Android earlier than 7.0 the FLAG_ACTIVITY_NEW_TASK
is needed when starting an activity from a non-activity context.

This was removed in Android 7.0 (possibly by mistake), see
https://code.google.com/p/android/issues/detail?id=226647.

Fixes #802
This commit is contained in:
Fredrik Fornwall
2017-03-02 00:29:17 +01:00
parent ed1874db05
commit 11ed7e45d8

View File

@@ -31,6 +31,7 @@ public class TermuxOpenReceiver extends BroadcastReceiver {
final boolean isExternalUrl = data.getScheme() != null && !data.getScheme().equals("file");
if (isExternalUrl) {
Intent viewIntent = new Intent(Intent.ACTION_VIEW, data);
viewIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
context.startActivity(viewIntent);
} catch (ActivityNotFoundException e) {