mirror of
https://github.com/nix-community/nix-on-droid-app.git
synced 2025-12-03 15:41:07 +01: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:
parent
ed1874db05
commit
11ed7e45d8
1 changed files with 1 additions and 0 deletions
|
|
@ -31,6 +31,7 @@ public class TermuxOpenReceiver extends BroadcastReceiver {
|
||||||
final boolean isExternalUrl = data.getScheme() != null && !data.getScheme().equals("file");
|
final boolean isExternalUrl = data.getScheme() != null && !data.getScheme().equals("file");
|
||||||
if (isExternalUrl) {
|
if (isExternalUrl) {
|
||||||
Intent viewIntent = new Intent(Intent.ACTION_VIEW, data);
|
Intent viewIntent = new Intent(Intent.ACTION_VIEW, data);
|
||||||
|
viewIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
try {
|
try {
|
||||||
context.startActivity(viewIntent);
|
context.startActivity(viewIntent);
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue