Android: Get Time Spent Per Activity

穿精又带淫゛_ 提交于 2019-12-05 14:48:16

So what do you think -- anything better than those options?

Anything is better than #2, which requires custom firmware.

#1 is your only option within the SDK for API Level 13 on down AFAIK.

API Level 14 (a.k.a., Android 4.0) added in Application.ActivityLifecycleCallbacks, which you can register via registerActivityLifecycleCallbacks() called on your Application (e.g., getApplicationContext()). I haven't used these yet, but it would appear that you can arrange for a single listener to be notified of activities coming and going, avoiding forcing you to extend some common base Activity class with your desired logging.

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