Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google login in android webview stuck in a page where it prompts "One Moment Please" and a loading Progress Bar

I have a webview in my android app which loads a website which has a google login button. When login button is pressed it opens a browser and after signing in it gets stuck in a page which prompts "One moment please". Why is it getting stuck in that page and not redirecting to the app?

like image 695
Deep Avatar asked Jul 29 '19 09:07

Deep


People also ask

How do I close WebView on Android?

Add a close button and on its click set: webview. setVisibility(View. INVISIBLE); webview.

Why is my WebView not working?

You might often face issues in updating the chrome and Android System Webview. To fix this problem, you can reboot your device, check your internet connection, stop auto-updating all apps, clear Google Playstore cache, and storage, leave the beta testing program, and manually update Android WebView app from Playstore.

How do I turn off click on WebView?

Open Play Store on your device, search for Android System WebView and click on it. Now you can see the option of Disable, press it, the app is now disabled.

Is Android WebView deprecated?

This interface was deprecated in API level 12. This interface is now obsolete.


1 Answers

First of all use this setting for your webview :

WebView vistaWeb = (WebView) findViewById(R.id.webview);
vistaWeb.setWebChromeClient(new MyCustomChromeClient(this));
vistaWeb.setWebViewClient(new MyCustomWebViewClient(this));
vistaWeb.clearCache(true);
vistaWeb.clearHistory();
vistaWeb.getSettings().setJavaScriptEnabled(true);
vistaWeb.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);

Then if that wasn't quit the answer, use a library from github webview library or use Chrome custom tab.

like image 81
Amir Hossein Avatar answered Nov 15 '22 05:11

Amir Hossein