Tracking screen time in android

会有一股神秘感。 提交于 2021-01-27 12:50:44

问题


for a university project I have to track the screen time of an android smartphone. It's hard to find proper search results, because my search engines do only suggest apps, that already do this for you. I am interested in how these apps do this. I assume, there is a native API on android which supports you with this. Unfortunately, I can't find anything that already does this.

The app is supposed to run a little service which tracks the time of the screen activity and other stuff (like location). It would be great, if someone of you can help me out on where to look for examples and where to find information about the android API.

Edit: To be a bit more precise: It's about the overall screen time, not about the screen time a specific app has.


回答1:


Broadcast Actions might be a solution for this,

ACTION_SCREEN_ON

ACTION_SCREEN_OFF

https://developer.android.com/reference/android/content/Intent.html#ACTION_SCREEN_ON

https://developer.android.com/reference/android/content/Intent.html#ACTION_SCREEN_OFF



来源:https://stackoverflow.com/questions/59563346/tracking-screen-time-in-android

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