0

i need to know how set up a counter in android witch is shown in an activity the counter is like this: it will start when the user first install the application and it will be automatically increment by the days for EX in if the user install the application monday then Wednesday the counter will be equal to 2 with the possibility to reset it to 0 when the user want and it will increment even if the user are not using the application thank in advance

Yous Sef
  • 43
  • 1
  • 5

1 Answers1

0

Here is how you can get the install date:

long installed = context
.getPackageManager()
.getPackageInfo("package.name", 0)
.firstInstallTime;

You'll have to do your own bookkeeping if you want to reset it/etc..

Community
  • 1
  • 1
Buddy
  • 10,874
  • 5
  • 41
  • 58