Payment OR Data link open in system browser for the supported android 13 new changes Added.#1001
Payment OR Data link open in system browser for the supported android 13 new changes Added.#1001CharanTatu wants to merge 1 commit into
Conversation
The code supported Android API levels of more than 13 also the Google Pixel 7 pro for the capacitor user. also Cordova .
|
Hi, all this code is perfectly working for payment links Or data links open in system browser support for Android 13. try { |
| @@ -454,20 +454,46 @@ private HashMap<String, String> parseFeature(String optString) { | |||
| */ | |||
| public String openExternal(String url) { | |||
There was a problem hiding this comment.
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 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();
}
The code supported Android API levels of more than 13 also the Google Pixel 7 pro for the capacitor user. also Cordova .
Platforms affected
Motivation and Context
Description
Testing
Checklist
(platform)if this change only applies to one platform (e.g.(android))