*我得到一些像这样的数据*
UsageStatsManager usageStatsManager = (UsageStatsManager) this.getSystemService("usagestats");
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, -1);
long start = calendar.getTimeInMillis();
long end = System.currentTimeMillis();
List<UsageStats> stats = usageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, start, end);
//Map<String,UsageStats> stats =usageStatsManager.queryAndAggregateUsageStats( start, end);
for (int i = 0; i < stats.size() ; i++)
{
Log.e(TAG,"<<<<"+i+">>>>"+"--------------------------------------------------------------------------");
Log.e(TAG,"Package Name = "+stats.get(i).getPackageName());
printt("First Time Stamp = ",stats.get(i).getFirstTimeStamp());
printt("Last Time Stamp = ",stats.get(i).getLastTimeStamp());
printt("Last Time Used = ",stats.get(i).getLastTimeUsed());
printt("Total Time Used in foreground = ",stats.get(i).getTotalTimeInForeground());
}
但是我如何计算和显示这样以及如何从这些可用数据中获取应用开始时间和结束时间