Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maintaining user session in Android

I am trying to make social network application for Android. My question is how to maintain user session when user logs in?

Please help me to find the solution for the above question.

like image 436
Vipul Narkhede Avatar asked Feb 20 '23 11:02

Vipul Narkhede


1 Answers

try

public class Session {
private static String sessionId;
private static String userRole;

public static void setSessionId(String sessionId) {
    Session.sessionId = sessionId;
}

public static String getSessionId() {
    return sessionId;
}

}

Use this class and import it in every other activity. You can define your own functions to maintain your specific session data

like image 74
Aalok Sharma Avatar answered Mar 05 '23 03:03

Aalok Sharma