Questions tagged [android-cookiemanager]

CookieManager is a public class in the Android API that manages the cookies used by an application's WebView instances. Cookies are manipulated according to RFC2109.

54 questions
45
votes
5 answers

How to handle cookies in httpUrlConnection using cookieManager

I have a server request that returns multiple cookies, like that: This is how I'm storing these cookies to the cookieManager: HttpURLConnection connection = ... ; static java.net.CookieManager msCookieManager = new…
David
  • 37,109
  • 32
  • 120
  • 141
23
votes
2 answers

Android cookie manager - How to get all cookies

I need to get all the cookies that are stored in the webview. Currently the default webview. https://developer.android.com/reference/android/webkit/CookieManager.html Currently it only supports: getCookie(String url) I need the ability to get all…
darewreck
  • 2,576
  • 5
  • 42
  • 67
15
votes
5 answers

Webview cannot accept cookies

I'm creating a WebView based Android app that enables the user to login onto a mobile operator. When I run the app the WebView opens the website but I get a message that the WebView doesn't allow cookies. I've tried various codes that I found here…
8
votes
1 answer

What does it mean by VM wide cookie management?

I am learning to store cookies in Android and came across several ways of implementing it. One of them being the use of CookieManager and CookieStore. As I was going through Android docs, I came across the following statement: To establish and…
6
votes
0 answers

Android WebView get raw cookie information

I try to get cookie information with CookieManager in Android WebView. However, all it does is providing a key value pair of cookies, no additional information. I also tried this post and use connection.getHeaderFields.get("Set-Cookie"); to get all…
Yao
  • 709
  • 2
  • 11
  • 22
6
votes
2 answers

How to persist webview cookies between app executions?

It is possible to achieve this currently in Android? I only can find deprecated questions about old methods (CookieSynchManager) which not seems to work for this actually. It is possible to achieve it? I can't find anything also on the Android…
6
votes
1 answer

Session Cookie Not Persistent in Retrofit Android

Hi I am currently developing an Android application that uses Retrofit for making Network calls.Here is a basic over overview on my requirement. 1.Get Facebook access token and send it to the server. 2.The server sets a Session cookie in…
Gowtham Raj
  • 2,915
  • 1
  • 24
  • 38
6
votes
0 answers

How to save/load cookies to/from SharedPreferences with net.java.CookieManager?

In order to manage session through cookies in my HttpURLconnection I use CookieManager cookieManager = new CookieManager(); CookieHandler.setDefault(cookieManager); Now when I exit my app the cookies are deleted. How can I save them to…
jul
  • 36,404
  • 64
  • 191
  • 318
5
votes
0 answers

Do I need to flush after setCookie in CookieManager?

I have a code that writes the cookies from okHttp to CookieManager as below. @Override public void saveFromResponse(HttpUrl url, List cookies) { CookieManager webviewCookieManager = CookieManager.getInstance(); String urlString =…
Elye
  • 53,639
  • 54
  • 212
  • 474
5
votes
2 answers

Multiple cookies in CookieManager

Lets prepare for cookie storing: CookieSyncManager.createInstance(getApplicationContext()); CookieSyncManager.getInstance().startSync(); CookieManager.getInstance().setAcceptCookie(true); Then I'm putting manually some cookies, lets say PHPSESSID…
snachmsm
  • 17,866
  • 3
  • 32
  • 74
5
votes
2 answers

Does CookieManager loses the cookie when you close the app?

I am working on an app which talks to server and have a login screen. I am using httpconnection to communicate with server (server sends Json response back). My login screen send email and password, which is validated by server - which sends the…
5
votes
1 answer

Java android - CookieHandler - How to keep cookies after closing the app?

To keep cookies after each request in HttpURLConnection, should to add CookieHandler on the app starting: CookieManager cookieManager = new CookieManager(); CookieHandler.setDefault(cookieManager); But in the app closing and opening again the…
3
votes
0 answers

Saving persistent cookies on Android Native apps

When developing for a browser, cookies are seamless. However, as I'm finding out, when developing native java apps for android this is a whole new story. What is the best way to store Persistant cookies on android? I send both session and regular…
3
votes
0 answers

Get session cookie from android webview

I'm currently developing a cordova app with an ADFS authentication through inappbrowser. This works well so far. But I need to retrieve the session cookie stored in the webview instance and be able to use it in another application with the same…
csnv
  • 31
  • 1
3
votes
0 answers

Detect cookie expiry on Android web view

I am setting cookies from android side with an expiry time. But I want to detect when cookie expire is there a event fire from android web view?
Chinthaka Devinda
  • 997
  • 5
  • 16
  • 36
1
2 3 4