How to Get the Time spent on an application in Android Programmatically

前端 未结 3 924
借酒劲吻你
借酒劲吻你 2020-12-01 04:39

I want to get the Usage time of all those applications which i have used today.

As i am getting the those details by dialing *#*#4636#*#*. But i want t

3条回答
  •  旧时难觅i
    2020-12-01 05:27

    From Android 5.0 we can use android.app.usage.usageStats to get the total time an app has been used by accessing getTotalTimeInForeground(). For more details, refer here

提交回复
热议问题