In our app, click links call webview. so, i need to transfer some data to webview. I think 'cookie' will be help us. but i can't find good guide.
App can create cookie for webview? if possible, it can contain all type of datas? or limited?
I don't know web well. please help me!
P.S. I don't know ios, too. it's policy is same to android?
1)If you have cookies then you can insert cookies into your webview.
CookieManager cookieManager = CookieManager.getInstance();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
cookieManager.setAcceptThirdPartyCookies(webView, true);
} else {
cookieManager.setAcceptCookie(true);
}
for (String parse : cookie.split(";")) {
// System.out.println("==parse== "+parse);
cookieManager.setCookie("your_url.com"), parse);
}
Map<String, String> abc = new HashMap<String, String>();
abc.put("Cookie", cookie);
webView.loadUrl("your_url.com", abc);
2)App cannot create cookies for webview. but webview can create cookies for your App.
String cookies = cookieManager.getCookie("your_url.com");
System.out.println("==cookie== "+cookies);
I think it will help to understand the web & cookies concept. If you have query just let me know.