如何获取android中其他应用程序的屏幕时间? [英] How do i get screen time of other applications in android?

查看:75
本文介绍了如何获取android中其他应用程序的屏幕时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解在android系统上运行的每个应用程序的屏幕显示时间.例如,有3个小时的Facebook工作时间,但有1.2个小时的屏幕时间.我怎么才能得到它?

I want to reach screen time of every application that's working on android system. For example, there are 3 hours of facebook working time but 1.2 hours of screen time. How can i get it?

推荐答案

android.app.usage

使用情况统计

public final class UsageStats 
extends Object implements Parcelable

java.lang.Object
   ↳    android.app.usage.UsageStats

我认为您需要的是

getFirstTimeStamp

获取该时间范围的开始 UsageStats 表示,以自纪元以​​来的毫秒数为单位.和 getLastTimeStamp

Get the beginning of the time range this UsageStats represents, measured in milliseconds since the epoch. and getLastTimeStamp

获取此 UsageStats 表示的时间范围的结束点,以自纪元以​​来的毫秒数为单位.

Get the end of the time range this UsageStats represents, measured in milliseconds since the epoch.

文档

这篇关于如何获取android中其他应用程序的屏幕时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆