1

I would like to know how many times the user spend on my application to block or release some feature after 15min. But, I would like 15min of use and not 15min after the first launch of the app per day. I mean, I don't want to count minutes when the app is in background

I have no idea how I could do that simply, any idea ?

Yohann L.
  • 1,262
  • 13
  • 27
  • Check this https://stackoverflow.com/questions/12093048/counting-how-many-times-my-android-app-has-been-opened – Ninja Jul 24 '17 at 14:24

1 Answers1

0

You can set an ActivityLifecycleCallback to your application.

  1. Create a class AppActivityLifecycleCallbacks that implements Application.ActivityLifecycleCallbacks.
  2. Use this class to manage the time spent in your app.
  3. In your Application class, create an instance of your AppActivityLifecycleCallbacks and pass it as parameter to this command: registerActivityLifecycleCallbacks(myInstance)

It is all set!