usageevents

Count how many times every app is used in one day using UsageEvents, UsageEvents.Event and MOVE_TO_FOREGROUND

懵懂的女人 提交于 2019-12-24 09:31:18
问题 With UsageStatsManager and UsageStats I'm able to obtain the daily usage (in houres, minuts and seconds) of every app on my smartphone. Now I want to know if there is a way to obtain the daily frequency of use (in numbers of times, i.e. 1 times, 2 times, etc) of every app on my smartphone. Reading the documentation I deduced that this could be achieved using UsageEvents, UsageEvents.Event and MOVE_TO_FOREGROUND. So I wrote the following code: // Get the app statistics since one day ago from