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?