CharanTatu commented on PR #1001:
URL:
https://github.com/apache/cordova-plugin-inappbrowser/pull/1001#issuecomment-1613554082
Hi, all this code is perfectly working for payment links Or data links open
in system browser support for Android 13.
try {
Uri uri = Uri.parse(url);
String scheme = uri.getScheme();
Intent intent = null;
intent = "data".equals(scheme)
? Intent.makeMainSelectorActivity(Intent.ACTION_MAIN,
Intent.CATEGORY_APP_BROWSER)
: new Intent(Intent.ACTION_VIEW);
if ("file".equals(scheme)) {
intent.setDataAndType(uri,
webView.getResourceApi().getMimeType(uri));
} else {
intent.setData(uri);
}
// intent.setPackage("com.android.chrome"); // Specify the
package name of Chrome
PackageManager packageManager =
cordova.getActivity().getPackageManager();
List<ResolveInfo> resolveInfoList =
packageManager.queryIntentActivities(intent, 0);
if (resolveInfoList.size() > 0) {
cordova.getActivity().startActivity(Intent.createChooser(intent,
"com.android.chrome"));
} else {
// Chrome is not installed,
intent.setPackage(null);
cordova.getActivity().startActivity(Intent.createChooser(intent,
"com.android.chrome"));
}
return "";
} catch (Exception e) {
LOG.d(LOG_TAG, "InAppBrowser: Error loading url " + url + ":
" + e.toString());
return e.toString();
}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]