This question has been asked and answered before but due to the limitation of not being able to comment when less than 50 reputation points, I have to make this a question instead.
I wanted someone to help me how to get back to my own website after using user-agent as specified in this answer setting user-agent.
I get this
after clicking Login with Google
instead of getting redirected after the authentication to the preference filling I instead get this white screen.
This also does not seem to be an emulator-only issue as well as I have found in some Stackoverflow threads as it is still the same when I run it on my Android 10 device Samsung S9 when installing the app.
Most probably, the issue is that I have set no webpage to load after user agent but since I am new to this, I don't have a lot of idea on how to do that. Please, point me in the right direction.
This is the website built by my friend if you go in and fill preference you should be able to log in and that's what I wanted to implement in a WebView for my Android Application. Also here is how I have coded my app if it helps any better to debug the issue...
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getSupportActionBar() != null) {
getSupportActionBar().hide();
}
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
webView=findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webView.getSettings().setUserAgentString(
webView.getSettings().getUserAgentString().replace("; wv)", ")")
);
webView.setWebChromeClient(new WebChromeClient());
webView.setWebViewClient(new WebViewClient()
{
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
return super.shouldOverrideUrlLoading(view, request);
}
@Override
public void onPageFinished(WebView view, String url)
{
super.onPageFinished(view, url);
}
});
webView.getSettings().setAllowFileAccess(true);
webView.loadUrl("https://selectpreference.web.app/");
}
@Override
public void onBackPressed() {
if(webView.canGoBack())
{
webView.goBack();
}
else
{
super.onBackPressed();
}
}
As for the XML it's only a WebView. Thanks for reading this post.