0

here Before displaying the dialog check the preferences to get the time that it was last displayed. If it's been more than three days, display the dialog and set a new time in SharedPrefs.

here is my code but it crashed my app , pls tell what i am missing here

long time = sharedPrefs.getLong("displayedTime", 0);
if (time < System.currentTimeMillis() - 259200000) {
displayDialog();
prefsEditor.putLong("displayedTime", System.currentTimeMillis()).commit();
}
user6405383
  • 146
  • 1
  • 2
  • 13

1 Answers1

0

You are actually looking for JobSchedular

and See this you can get some idea on how to implement it here

Community
  • 1
  • 1
Shuddh
  • 1,920
  • 2
  • 19
  • 30