anroid webview中的google登录(oauth2.0)卡在“请稍等…”

0md85ypi  于 2021-07-12  发布在  Java
关注(0)|答案(0)|浏览(273)

我正在通过android工作室制作一个webview应用程序。这个网站是通过vue创建的,我们计划通过google登录使用这个服务。但是,当我从webview用google登录时,我不能用短语“请稍等…”(但我可以在pc上登录!)
我该怎么修?
这是我的密码:

package com.example.upasstest;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainActivity extends AppCompatActivity {
    private WebView mWebView;
    private WebSettings mWebSettings;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        String USER_AGENT = "\"Mozilla/5.0 AppleWebKit/535.19 Chrome/56.0.0 Mobile Safari/535.19\"";

        mWebView = (WebView) findViewById(R.id.webView);

        mWebView.setWebViewClient(new WebViewClient());

        mWebView.clearCache(true);
        mWebView.clearHistory();

        mWebSettings = mWebView.getSettings();

        mWebSettings.setUserAgentString(USER_AGENT);
        mWebSettings.setJavaScriptEnabled(true);
        mWebSettings.setSupportMultipleWindows(false);
        mWebSettings.setJavaScriptCanOpenWindowsAutomatically(true);
        mWebSettings.setLoadWithOverviewMode(true);
        mWebSettings.setUseWideViewPort(true);
        mWebSettings.setSupportZoom(false);
        mWebSettings.setBuiltInZoomControls(false);
        mWebSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
        mWebSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
        mWebSettings.setDomStorageEnabled(true);

        mWebView.loadUrl("my url");
    }
}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题