简体   繁体   English

如何获取Android上的应用程序使用情况统计?

[英]How to get application usage statistics on android?

What I want is to access the time (in milliseconds) that each application is used. 我想要的是访问每个应用程序的使用时间(以毫秒为单位)。

Thanks 谢谢

Dig up the source to "Spare Parts" and see how they do it 将源代码挖到“备件”,看看他们是如何做到的

(also copy it off the emulator, install it on your phone and make sure it works) (还要将其从模拟器中复制出来,安装在手机上并确保其正常工作)

Note: while this remains accurate for the circa-2010 versions of Android about which it was written, restrictions added years later in 4.4 and 5.0 would substantially frustrate achieving this in more recent versions. 注意:虽然这对于2010年左右的Android版本来说仍然是准确的,但是在4.4和5.0之后的几年后增加的限制将大大阻碍在更新版本中实现这一点。

@João Lopes,Chris Stratton @JoãoLopes,Chris Stratton

Google Provide the sample code for AppUsageStatistics Sample Google提供AppUsageStatistics Sample的示例代码

Here full of statistics base on daily weekly monthly usages. 这里有充分的统计数据,基于每日每周用量。

You could use TraceView . 您可以使用TraceView Did you mean by programming? 你的意思是编程吗?

By Programming, You can check out how SpareParts does it. 通过编程,您可以查看SpareParts如何做到这一点。

Firebase Analytics has a cool feature where it tracks the average time on each screen and the percentage of which screen is used most often. Firebase Analytics具有很酷的功能,可以跟踪每个屏幕上的平均时间以及最常使用的屏幕百分比。

Is this is good enough for you, I would suggest adding Firebase to your app, as it has a free plan, and it will automatically track your users' time. 这对您来说是否足够好,我建议您将Firebase添加到您的应用中,因为它有免费计划,它会自动跟踪用户的时间。 You can start here 你可以从这里开始

Hope this helps 希望这可以帮助

您可以尝试使用FireBase Analytics

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM