In Android what's the best practice to maintain a session through multiple activities? -


i have app has log in screen goes other screens (in other activities), , needs maintain session throughout.

i've looked around , found couple methods don't account multiple activities.

i've found 1 using httpclient it's old , android saying it's better use httpurlconnection newer devices.

so i'm not sure 1 use , how. since other activities stem single activity thinking of making them child activities login page , having them reference session through mainactivity.session (or whatever it's called).

any advice?

session cookies maintained http stack using. activities not play role.

for example, if read the documentation httpurlconnection, "sessions cookies" section shows how establish cookie manager app:

cookiemanager cookiemanager = new cookiemanager(); cookiehandler.setdefault(cookiemanager); 

then, not matter activity http operations done on -- relevant cookies other operations, since process started, included in subsequent requests.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -