新的5.0.x UsageStats定期重置

时间:2015-01-15 02:24:24

标签: android-5.0-lollipop

因此我们开始每小时收集使用情况统计信息,使用Interval_Daily

询问最后一小时
queryUsageStats(UsageStatsManager.INTERVAL_DAILY, startTime, timeNow);

其中timeNow每小时递增一次,并且总是提前一小时。

问题:

  1. 当用户在夜晚进入睡眠状态时,queryStats为空。这不是很糟糕,因为用户什么都不做
  2. 更重要的是,Usagestats有时会重置:
  3. 来自

    [{"start_time":"2015-01-14T13:12:00.154-0800"},
    {"app_package":"com.hipchat","app_time_in_foreground":886341,"app_launches":5}
    

    [{"start_time":"2015-01-14T14:11:49.814-0800"},
    {"app_package":"com.hipchat","app_time_in_foreground":48851,"app_launches":3}
    
    1. 使用情况统计信息在重置之前是累积的
    2. [{"start_time":"2015-01-14T09:12:00.242-0800"},
      {"app_package":"com.hipchat","app_time_in_foreground":230317,"app_launches":11}
      
      [{"start_time":"2015-01-14T10:11:37.839-0800"},
      {"app_package":"com.hipchat","app_time_in_foreground":712018,"app_launches":24}
      
      [{"start_time":"2015-01-14T11:11:50.694-0800"},
      {"app_package":"com.hipchat","app_time_in_foreground":792177,"app_launches":6}
      
      [{"start_time":"2015-01-14T12:11:49.643-0800"},
      {"app_package":"com.hipchat","app_time_in_foreground":815998,"app_launches":3}
      
      [{"start_time":"2015-01-14T13:12:00.154-0800"},
      {"app_package":"com.hipchat","app_time_in_foreground":886341,"app_launches":5}
      

      然而,通过查看" app_launches"

      ,似乎UsageEvents不是累积的。

      有人可以澄清一切吗?

0 个答案:

没有答案