0

I am wanting to track the running time of a user's apps over time. The only way I can think to do this currently is run a background process that, each minute, grabs the list of running processes and adds them to the app's time count. Is there a more efficient way of doing this that doesn't require an operation in the background every minute?

AggieDev
  • 5,015
  • 9
  • 26
  • 48

1 Answers1

0

Instead of logging a certain interval i would log the time of application startup and application shutdown. To figure out when to log, look at the image at this link: http://developer.android.com/reference/android/app/Activity.html

As you can see you can just log the time in onCreate, and then again in onDestroy. Then i would save the difference in time between these and then save that to either a file or shared preferences or something similar.

Mattias F
  • 602
  • 6
  • 11
  • I am trying to track the running time of other apps, not my own. I do not have access to other apps' onCreate()'s and onDestroy()'s. – AggieDev Feb 21 '14 at 23:12