Sunday, 9 October 2022

Cordova Android ICordovaCookieManager use from plugin

I'm trying, from a Cordova plugin, to set a cookie to the webview. I've checked the cordova-android source and it appears that there is a CookieManager interface. When I'm trying to use it, the cookie isn't set when I inspect the webview.

 @Override
 public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);  

    ICordovaCookieManager cookieManager = webView.getCookieManager();
    cookieManager.setCookiesEnabled(true);
    cookieManager.setCookie("https://com.myapp", "test=test");
 }

Note that I'm using the https://com.myapp as host as it is set in the hostname preference. I've also tried http://localhost and https://localhost..

How do I use ICordovaCookieManager to set a cookie ?



from Cordova Android ICordovaCookieManager use from plugin

No comments:

Post a Comment