最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - android UsageStatsManager API to get sessions count for each app along with the duration - Stack Overflow

programmeradmin1浏览0评论

i want to build an app similar to StayFree but for company use only not for google play

but there is one thing that i could not achieve , which is the session count for each app also the total time spent on the app for the corresponding session , how did they implement it ? this is what I'm talking about stayfree - session , anyway this is an old screenshot , but this is what I'm looking for

also can someone suggest on a way to schedule the data to be sent to the server from all users ? so i can monitor all users on a specific date , also i want to take into consideration the offline users on a specific day.

and last thing there is some data regarding the battery consumption and network consumption in the settings app , can i read this data also ?

the data I'm getting from the UsageStats class is

long totalTimeInForeground = us.getTotalTimeInForeground();
                        long lastTimeUsed = us.getLastTimeUsed();
                        long firstTimeStamp = us.getFirstTimeStamp();
                        long totalTimeVisible = 0;
                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
                            totalTimeVisible = us.getTotalTimeVisible();
                        }
发布评论

评论列表(0)

  1. 暂无评论