mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-05 02:05:25 +08:00
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:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user