Android WebView HTTP Cookies not working in API 21

后端 未结 1 1061
不知归路
不知归路 2021-02-10 01:08

I have an Android application that uses WebView and HTTP cookies. This application works on Android devices running API 19 or below. API 21 is not saving the http cookie for l

1条回答
  •  伪装坚强ぢ
    2021-02-10 01:29

    API 21 or Lollipop requires this to be added to your APP

    if (Build.VERSION.SDK_INT >= 21) {
        // AppRTC requires third party cookies to work
        CookieManager cookieManager = CookieManager.getInstance();
        cookieManager.setAcceptThirdPartyCookies(mWebView, true);
    }
    

    Works again!

    0 讨论(0)
提交回复
热议问题