Android user session stored in sqlite db, this is implementation of
- deckyfx/dbhelper
- deckyfx/simpleadapter
- gson
- greendao
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency
dependencies {
compile 'com.github.deckyfx:dbsession:-SNAPSHOT@aar'
}
Create class to define your session data
public class SessionData extends BaseItem {
public String username;
}
Then init DBSession
...
DBSession Session = new DBSession(getApplicationContext(), SessionData.class);
...
To save your user data
...
Session.set(/* Json String, JSONObject instance, or SessionData instance*/);
...
To check if your user is stored or not
...
Session.valid();
...
To clear user data
...
Session.clear();
...
More sample is [here]