私は 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/");
これを機能させるためのアイデアがあれば、お知らせください。私はたくさん検索しようとしましたが、有用なものは見当たりません。