26
25

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Android WebViewのクッキー取得方法

Last updated at Posted at 2013-10-23

WebViewでクッキーを取得する場合の方法

WebViewでクッキーを取得する場合は、CookieManagerを使用します。

WebView webView = findById(R.id.webview);
webView.setWebViewClient(new WebViewClient() {
    @Override
    public void onPageFinished(WebView view, String url){
                // Cookieを取得
        String[] cookies = CookieManager.getInstance().getCookie(url).split(";");
        for(String cookie : cookies){
            Log.d("", cookie);
        }
    }
} 
26
25
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
26
25

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?