Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android如何将google帐户传递到webview_Android_Webview_Google Calendar Api_Account - Fatal编程技术网

Android如何将google帐户传递到webview

Android如何将google帐户传递到webview,android,webview,google-calendar-api,account,Android,Webview,Google Calendar Api,Account,我使用webview显示google canlender,但希望通过编程方式传递google帐户,因此setHttpAuthUsernamePassword函数应该是我所需要的,但它根本不起作用。代码如下: WebView webview = (WebView) findViewById(R.id.webview); webview.getSettings().setJavaScriptEnabled(true); webview.setHttpAuthUsernamePassword("www

我使用webview显示google canlender,但希望通过编程方式传递google帐户,因此setHttpAuthUsernamePassword函数应该是我所需要的,但它根本不起作用。代码如下:

WebView webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.setHttpAuthUsernamePassword("www.google.com", "", "email", "password");

    webview.setWebViewClient(new WebViewClient() {
        @Override 
        public void onReceivedHttpAuthRequest (WebView view, HttpAuthHandler handler, String host,String realm){ 
            handler.proceed("email","password"); 
            }
        } 

        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            Toast.makeText(activity, description, Toast.LENGTH_SHORT).show();
        }
    });

    webview.loadUrl("http://www.google.com/calendar/");

如果你有任何想法,让这个工作,请让我知道。我试着搜索了很多,但没有发现任何有用的

您正在尝试使用HTTP身份验证http://en.wikipedia.org/wiki/Basic_access_authentication 这是大多数web服务不支持的。您需要有有效的Google Cookie,只有在您使用密码手动登录时才会设置这些Cookie。

您正在尝试使用HTTP身份验证http://en.wikipedia.org/wiki/Basic_access_authentication 这是大多数web服务不支持的。您需要有有效的Google Cookie,只有当您使用密码手动登录时才会设置这些Cookie。

我认为这永远不会起作用,因为即使使用Google api java客户端,我们仍然需要用户输入进行授权。在这里结账。请纠正我,如果…我认为这永远不会工作,因为即使使用谷歌api java客户端,我们仍然需要用户输入进行授权。在这里结账。如果……请纠正我。。。。