Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

ERR_UNKNOWN_URL_SCHEME #438

Open
mjromka opened this issue Apr 24, 2020 · 2 comments
Open

ERR_UNKNOWN_URL_SCHEME #438

mjromka opened this issue Apr 24, 2020 · 2 comments

Comments

@mjromka
Copy link

mjromka commented Apr 24, 2020

On some Android devices users get ERR_UNKNOWN_URL_SCHEME during authentication on redirect, see attachment:
8fb8f8be-5142-4d16-8ce2-546fb5919436 jpg 2020-04-25 00-27-07

Happened on Alcatel, Pop 4S and on some other model.

This is my intercepting intent:
Activity(Label = "CustomUrlSchemeInterceptorActivity", NoHistory = true, LaunchMode = LaunchMode.SingleTop)] [IntentFilter( new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable }, DataSchemes = new[] { "***.co.identity.oauth" }, DataPath = "/oauth2redirect")] public class CustomUrlSchemeInterceptorActivity : Activity { protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); var uri = new Uri(Intent.Data.ToString()); new System.Threading.Tasks.Task(() => { var intent = new Intent(ApplicationContext, typeof(MainActivity)); intent.AddFlags(ActivityFlags.IncludeStoppedPackages); intent.AddFlags(ActivityFlags.ReorderToFront); StartActivity(intent); }).Start(); App.Authenticator.OnPageLoading(uri); Finish(); } }

It works fine on other devices although I see no appropriate automatically inserted into AndroidManifest.xml

@mjromka
Copy link
Author

mjromka commented May 21, 2020

The issue seems to be only on Android <= 6.0 (Marshmallow) as it was also pointed here #395
Do you think you will take care of it one day or will wait until this Android version will be deprecated?

@linehammer
Copy link

linehammer commented Mar 8, 2021

This error is appeared because the WebView can’t recognize the URL Scheme,for example, the WebView will usually recognize only http and https, anything other than these. So WebView cannot parse it to right place, we should use intent to redirect the url. for example – intent://,market://,app://,mail:// etc will not be recognized by webview unless we add a handler to handle these url scheme or by disabling these schemes and only load http and https schemes.

This error has no any specific solution till now. Android user and PC user all are facing this error which needs to be sought out. There's a long-standing bug in Chromium regarding how links without protocols are handled. It occasionally is patched, but seems to keep resurfacing. In some cases, prefixing your links with http:// (or https://) should resolve the issue for you.

Also, in some cases, try to add target="_blank" in your URL Scheme/Code. for example:

<a href="mailto:my@email.com" target="_blank">Link Text</a>

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

No branches or pull requests

2 participants