Reputation: 4650
I am working in an android application and I want to implement Remember Me functionality for a particular time in my android application. I used shared preference to save these values but how can I delete my values in shared preference after a particular time period say for example 1 hour or is there any other method to implement this?
Upvotes: 0
Views: 150
Reputation: 3617
You can make use of Alarm Manager
To start with, go through this sample project
Upvotes: 1
Reputation: 1493
This is for clearing the sharedpreferences:
SharedPreferences sharedDelete = PreferenceManager.getDefaultSharedPreferences(this);
sharedDelete.edit().clear().commit();
And take look at AlarmManager
or Handler
or Timer
for doing this delete after 1 hour.
Upvotes: 0