I have a WebView that loads a certain URL, on loading I set some cookies to the website. I noticed if the user clicks any link on the website, the cookies I set don’t effect the new page. Is there a way to set the cookies every time there is a page navigation? This is my code to set the cookies.
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setAcceptCookie(true);
cookieManager.setCookie("URL HERE", "COOKIES HERE");
And upon navigation I am planning to use the following code to set the cookies for the new page.
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setAcceptCookie(true);
cookieManager.setCookie(browser.getUrl(), "My Cookies");
I found it. You can use the following code inside onCreate Method.