Java android track usage time installed app

我们两清 提交于 2019-12-19 08:20:08

问题


I need to track usage time of all installed apps, with java, in android OS. For example, this app is very very similar: https://play.google.com/store/apps/details?id=com.agrvaibhav.AppUsageTracking

Is there a way to do this?


回答1:


First of all you can use the android.app.ActivityManager to retrieve phone statue and running processes. An excellent example of doing this could be found here,

Java Code Examples for android.app.ActivityManager

You can also monitor the foreground activity to determine the Running tasks. Example here,

how do android monitor usage applications work

Lastly you can create your own service to detect each running process and their usage. A complete example of this procedure could be found here,

App to monitor other apps on android



来源:https://stackoverflow.com/questions/31097599/java-android-track-usage-time-installed-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!