Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android reading cookies

Hey, how can I read a value of a cookie?

Example:

String cs = CookieManager.getInstance().getCookie();
System.out.println("Cookies string:  "+cs);

This will give me a string which has to be parsed with split on ';' and '='. Is there a "cookie string reader" or smth? Is there any other way of reading the value of only one particular cookie in the webview?

Thx!

like image 804
xpepermint Avatar asked Apr 30 '11 09:04

xpepermint


People also ask

Can you view cookies on Android?

On your Android phone or tablet, open the Chrome app. Tap More button, marked as three dots, and then Settings, found at the top-right corner of the web page. Tap Site settings and then Cookies.

Where are cookies stored on Android?

You can find and tap “clear browsing data” at the top of the “privacy and security” page. Select “cookies and site data” and set the time range. Tap the data categories you want to delete; you can find more in the “advanced” section. Tap “clear data” to remove the cookies from your device.

How do I extract cookies from my Android?

Navigate to the cookies folder and copy them to a USB or SD card that your computer can read and then place them into the browser cookie files on the computer by going through the AppData folder to the browser files, and eventually finding the cookie folder and copying the files over.

What is cookie data on Android?

Cookies are files created by websites you visit. They make your online experience easier by saving browsing information. With cookies, sites can keep you signed in, remember your site preferences, and give you locally relevant content.


1 Answers

Well, I suggest that you parse the string into an Array yourself. That would then be something along these lines in standard Java:

String[] x = Pattern.compile(";").split(CookieManager.getInstance().getCookie());

Now you have an Array of name - value pairs, which you can further parse and then store.

like image 182
Witiko Avatar answered Sep 27 '22 18:09

Witiko