mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 00:20:32 +00:00
Fix opening links on Android 12+
This commit is contained in:
parent
c85af7861a
commit
4cc653fdf1
@ -90,19 +90,16 @@ public final class ShareUtils {
|
|||||||
// No browser set as default (doesn't work on some devices)
|
// No browser set as default (doesn't work on some devices)
|
||||||
openAppChooser(context, intent, true);
|
openAppChooser(context, intent, true);
|
||||||
} else {
|
} else {
|
||||||
if (defaultPackageName.isEmpty()) {
|
try {
|
||||||
// No app installed to open a web url
|
// will be empty on Android 12+
|
||||||
Toast.makeText(context, R.string.no_app_to_open_intent, Toast.LENGTH_LONG).show();
|
if (!defaultPackageName.isEmpty()) {
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
intent.setPackage(defaultPackageName);
|
intent.setPackage(defaultPackageName);
|
||||||
context.startActivity(intent);
|
|
||||||
} catch (final ActivityNotFoundException e) {
|
|
||||||
// Not a browser but an app chooser because of OEMs changes
|
|
||||||
intent.setPackage(null);
|
|
||||||
openAppChooser(context, intent, true);
|
|
||||||
}
|
}
|
||||||
|
context.startActivity(intent);
|
||||||
|
} catch (final ActivityNotFoundException e) {
|
||||||
|
// Not a browser but an app chooser because of OEMs changes
|
||||||
|
intent.setPackage(null);
|
||||||
|
openAppChooser(context, intent, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user