Get value from shared preferences in first time is not working
I save the device token in shared preferences and I only manage to get it on the second run.
This is the code:
class PreferencesHelper(context: Context) {
companion object {
private val usernameKey = "username_key"
private val passKey = "pass_key"
private val tokenKey = "token_key"
}
private val preferences = PreferenceManager.getDefaultSharedPreferences(context)
var username = preferences.getString(usernameKey, "")
set(value) = preferences.edit().putString(usernameKey,...