i need to add more time session life time . but cant add more 10-12 days
/**
* Logs in the user by saving user details and setting session
*
* @param username
* @param fullName
*/
public void loginUser(String username, String fullName) {
mEditor.putString(KEY_USERNAME, username);
mEditor.putString(KEY_FULL_NAME, fullName);
Date date = new Date();
//Set user session for next 7 days
long millis = date.getTime() + (30 * 24 * 60 *60 * 1000);
mEditor.putLong(KEY_EXPIRES, millis);
mEditor.commit();
}
>Solution :
You can use the actual value of the milliseconds you want. Convert from days to milliseconds for instance, in a clearer way.
long millis = date.getTime() + TimeUnit.MILLISECONDS.convert(30, TimeUnit.DAYS);
//this will add 30 days
You can change the 30 to whatever days you’d prefer.