Arun PS
Arun PS

Reputation: 4650

Remember me for 1 hour in android application

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

Answers (3)

Renjith
Renjith

Reputation: 3617

You can make use of Alarm Manager

To start with, go through this sample project

Upvotes: 1

RRTW
RRTW

Reputation: 3190

AlarmManager

SharedPreferences

They should help you~

Upvotes: 0

silvia_aut
silvia_aut

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

Related Questions