0

I want to get the time spent on different Android apps by the user(ex: how much time was spent on the Youtube app, or Gmali app, etc).

I know that first i need to check if that app is currently running in the foreground(i know how to do that), but after that, how can i measure the time spent on that app?

I found getElapsedCpuTime () from the android references, but I think it can be used only to get the elapsed time for your current app only. If not, how can i use it to get the elapsed time for a different installed app? Are there any other ways to implement this?

Limon Monte
  • 52,539
  • 45
  • 182
  • 213
  • Have you checked this thread ? http://stackoverflow.com/questions/2166961/determining-the-current-foreground-application-from-a-background-task-or-service – Kanak Sony Apr 12 '14 at 16:42
  • That thread is about checking/finding if an app is running on foreground. I mentioned that i already know that. The problem is how to get how long that app has been running. – user1833671 Apr 12 '14 at 17:27

1 Answers1

0

You may try Flurry that provides many tracking features. Also you may get current system time when the application starts and when it stops/destroy and on subtracting these two values you will get the time. Google Analytics also shows the device and time.

arin1405
  • 677
  • 1
  • 7
  • 18