Get App usage data of previous dates from UsageStatsManager Android
<p>If I want to get data of today's <strong>App usage</strong>, first I allowed my App from settings to read App usage statistics,
then  I am using this query to get <strong>UsageStats</strong> </p>

<pre><code>UsageStatsManager usm = (UsageStatsManager) context.getSystemService("usagestats");
</code></pre>

<p>(I am calculating startTimeStamp and endTimeStamp programmatically, but here it is hardcoded as an example).</p>

<pre><code>long  startTimeStamp = 1452124800000;           // today's Morning 12:00:00 AM
long  endTimeStamp= 1452211199000;              // today's Night 11:59:59 PM

List&lt;UsageStats&gt; usageStatsList = usm.queryUsageStats(UsageStatsManager.INTERVAL_BEST, startTimeStamp, endTimeStamp);
</code></pre>

<p>successfully I am getting correct data from <strong>UsageStatsManager</strong>.</p>

<p>But if I use same query to get data of <em>yesterday's</em> <strong>App Usage</strong>, I just changed  <code>startTimeStamp</code> and <code>endTimeStamp</code> values by <em>yesterday's</em> TimeStamp values.</p>

<p>I am not getting any data from <strong>UsageStatsManager</strong>. It returns me an empty list.</p>

<p>I have also tried the same query by changing <code>intervalType</code> to <code>UsageStatsManager.INTERVAL_DAILY</code>. but still, I am getting empty data from Android UsageStatsManager. </p>

<p>Is there any way to get App usage data of previous day(s) ??</p>