A
A
Anatoly2017-08-23 16:46:39
Android
Anatoly, 2017-08-23 16:46:39

What is the best way to store cookies in android?

I need to save the logged in user. They write that WebView implements this, but WebView is useless to me, I just have a button and an input field, a simple activity. Can you tell me how this is being implemented?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mitaichik, 2017-08-23
@mitaichik

I don't know how to store cookies. But, IMHO, Android applications usually use the REST API and properly authorize using access tokens.
And so - cookies are a regular object - you need to serialize it and write it somewhere, for example, in private preferences

K
Kurban Mammaev, 2017-08-23
@Axe98

I think you need to use the SharedPreferences class, it stores the data in a hidden folder after the application is installed. It works like this:
-Initialize the class
-Drive in the desired value, be it a number, a string or a symbol, into a "storage cell" like: shPref("name", 88005553535) , where name is the so-called "key", the name of the cell.
Google: shared preferences save/load example

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question