cordova-plugin-inappbrowser icon indicating copy to clipboard operation
cordova-plugin-inappbrowser copied to clipboard

Payment OR Data link open in system browser for the supported android 13 new changes Added.

Open CharanTatu opened this issue 2 years ago • 1 comments

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

  • [x] I've run the tests to see all new and existing tests pass
  • [ ] I added automated test coverage as appropriate for this change
  • [x] Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • [x] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • [ ] I've updated the documentation if necessary

CharanTatu avatar May 03 '23 13:05 CharanTatu

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();             }

CharanTatu avatar Jun 29 '23 17:06 CharanTatu