I want to set the timestamp and the reminder timestamp, for 3 hours for example, in SharedPreferences and then get the reminder timestamp. Then if 3 hours have passed, show an action. I have searched everywhere but I can't find an solution.
I have tried this code but it is not complete and I can't figure how to set and get the reminder timestamp:
Calendar c = Calendar.getInstance();
long currentTimeStamp = c.getTimeInMillis();
long reminderTimeStamp = getReminderTime();
if (BuildConfig.DEBUG) {
Log.v(TAG, "currentTimeStamp=" + currentTimeStamp);
Log.v(TAG, "reminderTimeStamp=" + reminderTimeStamp);
}
if (currentTimeStamp > reminderTimeStamp) {
//DO SOME ACTION
}