Reputation: 21
I have a simple Xamarin android app with a webview to display my own website.
I need to validate the email provided in the registration form, so I send a email with an "Activation link". When the user verify the address, is redirected to a confirmation page opened in the mobile default browser and automatically logged in. I need to send some data to notify the webview in the app about the new user status to login in the app too.
If the complete flow is done in a web browser (mobile or PC), it works fine.
Both solutions works fine sharing data from tab to tab in a browser (Chrome), but no access from browser to webview.
This is my webview definition:
WebView webView = FindViewById<WebView>(Resource.Id.webView);
webView.SetWebViewClient(new CustomizeWebviewClient(this));
webView.SetWebChromeClient(new ExtendedChromeClient(this));
webView.LoadUrl("http://myweb.com");
webView.Settings.JavaScriptEnabled = true;
webView.Settings.SetSupportZoom(true);
webView.Settings.BuiltInZoomControls = true;
webView.Settings.DisplayZoomControls = false;
webView.Settings.LoadWithOverviewMode = true;
webView.Settings.UseWideViewPort = true;
webView.Settings.SetSupportMultipleWindows(true);
webView.Settings.DomStorageEnabled = true;
webView.Settings.DatabaseEnabled = true;
if (Build.VERSION.SdkInt < BuildVersionCodes.Kitkat)
{
string dbPath = Application.Context.GetDir("database", FileCreationMode.Private).Path;
webView.Settings.DatabasePath = dbPath;
}
webView.ScrollBarStyle = ScrollbarStyles.OutsideOverlay;
webView.ScrollbarFadingEnabled = true;
Upvotes: 1
Views: 679
Reputation: 21
After lost several days searching and trying a lot of solutions that worked for others ( Intent filters, Deep links, App Links, ...), finally, I have decide to change the way to solve my problem: Instead to send a verification link, I'll send a verification code that the user has to insert in my web/app.
This way I can forget past, present and future problemas with:
Different Android versions
Works in all the emails providers and never will depend on the security policy changes of them
Totally cross browser and versions of them
Totally cross platform and device
The user is responsible to manage the flow between tabs or browser and app
Upvotes: 1