Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERR_UNKNOWN_URL_SCHEME : Error when opening other apps. #234

Open
TykanN opened this issue Dec 24, 2019 · 3 comments
Open

ERR_UNKNOWN_URL_SCHEME : Error when opening other apps. #234

TykanN opened this issue Dec 24, 2019 · 3 comments

Comments

@TykanN
Copy link

TykanN commented Dec 24, 2019

Screenshot_1577181549

When I click some button opening an apps(like Payment app, SNS app...) inside InAppWebView, page shows ERR_UNKNOWN_URL_SCHEME.
I want to open an app or search an app at store if not installed.
I use plugin which is the latest committed version.

This was referenced Jul 6, 2020
@bayramaliunuvar
Copy link

bayramaliunuvar commented Jun 22, 2021

shouldOverrideUrlLoading metodunu kullanmalısın.
Örneğin:
`
InAppWebView(
shouldOverrideUrlLoading:
(controller, navigationAction) async {
var uri = navigationAction.request.url;

                    if (uri.scheme.startsWith("tel")) {
                      print(uri.path);
                      if (await canLaunch(uri.path)) {
                        await launch(url);
                      }
                      return NavigationActionPolicy.CANCEL;
                    }

                    return NavigationActionPolicy.ALLOW;
                  })

`

@zhuwei
Copy link

zhuwei commented Sep 15, 2023

@bayramaliunuvar Not working,Still showing ‘ERR_UNKNOWN_URL_SCHEME’,for example:

shouldOverrideUrlLoading: (controller, navigationAction) async {
	var uri = navigationAction.request.url!;

	var s = uri.toString().toLowerCase();
	if (s.startsWith('intent:')) {
	  await launchUrl(uri, mode: LaunchMode.externalApplication);
	  return NavigationActionPolicy.CANCEL;
	} else if (s.startsWith('market:')) {
	  if (await canLaunchUrl(uri)) {
		await launchUrl(uri, mode: LaunchMode.externalApplication);
		return NavigationActionPolicy.CANCEL;
	  }
	}

	return NavigationActionPolicy.ALLOW;
}

@yuvisingh01
Copy link

@bayramaliunuvar Not working,Still showing ‘ERR_UNKNOWN_URL_SCHEME’,for example:

shouldOverrideUrlLoading: (controller, navigationAction) async {
	var uri = navigationAction.request.url!;

	var s = uri.toString().toLowerCase();
	if (s.startsWith('intent:')) {
	  await launchUrl(uri, mode: LaunchMode.externalApplication);
	  return NavigationActionPolicy.CANCEL;
	} else if (s.startsWith('market:')) {
	  if (await canLaunchUrl(uri)) {
		await launchUrl(uri, mode: LaunchMode.externalApplication);
		return NavigationActionPolicy.CANCEL;
	  }
	}

	return NavigationActionPolicy.ALLOW;
}

were you able to solve this??
as I am also getting the same error, while redirecting to payments app

I am trying it in this way
shouldOverrideUrlLoading: (controller, navigationAction) async {
// Future.delayed(const Duration(seconds: 1), () {
final uri = navigationAction.request.url;
if (uri != null) {
if (uri.scheme == 'intent') {
// Future.delayed(const Duration(seconds: 1), () {
// launchUrl(uri);
// });
print('within intent');

                return NavigationActionPolicy.CANCEL;
              } else if (uri.scheme == 'paytmmp') {
                // Future.delayed(const Duration(seconds: 1), () {
                if (await canLaunchUrl(uri)) {
                  await launchUrl(uri,
                      mode: LaunchMode.externalApplication);
                } else {
                  print('Could not launch ${uri.toString()}');
                }
                // });
                return NavigationActionPolicy.CANCEL;
              } else if (uri.scheme == 'tez') {
                Future.delayed(const Duration(seconds: 1), () {
                  launchUrl(uri, mode: LaunchMode.externalApplication);
                });
                return NavigationActionPolicy.CANCEL;
              } else if (uri.scheme == 'phonepe') {
                Future.delayed(const Duration(seconds: 1), () {
                  launchUrl(uri, mode: LaunchMode.externalApplication);
                });
                return NavigationActionPolicy.CANCEL;
              } else if (uri.scheme == 'upi') {
                Future.delayed(const Duration(seconds: 1), () {
                  launchUrl(uri, mode: LaunchMode.externalApplication);
                });
                return NavigationActionPolicy.CANCEL;
              } else if (uri.scheme == 'gpay') {
                Future.delayed(const Duration(seconds: 1), () {
                  launchUrl(uri, mode: LaunchMode.externalApplication);
                });
                return NavigationActionPolicy.CANCEL;
              } else if (uri.scheme == 'truecallersdk') {
                Future.delayed(const Duration(seconds: 1), () {
                  launchUrl(uri, mode: LaunchMode.externalApplication);
                });
                return NavigationActionPolicy.CANCEL;
              } else {
                // Future.delayed(const Duration(seconds: 1), () {
                //   launchUrl(uri);
                // });
                print('else');
                return NavigationActionPolicy.ALLOW;
              }
            }
            print('outside');

            return NavigationActionPolicy.ALLOW;
            // });
          },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants