Reputation: 41
Does Android OS store info on Apps like last run time, or how many times an app was run?
Upvotes: 4
Views: 1662
Reputation: 648
Calendar c = Calendar.getInstance();
c.add(Calendar.YEAR, -1);
long begin = c.getTimeInMillis();
long end = System.currentTimeMillis();
List<UsageStats> mListUsageStats = usageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_BEST, begin, end);
Then you can loop through the mListUsageStats objects and call getLastTimeUsed()
long lastRunTime = mListUsageStats.get(i).getLastTimeUsed();
Upvotes: 0
Reputation: 11246
Take a look at the processCpuUsage
method of BatteryHistory
to see how it retrieves a Uid.Proc
from which you can get the time spent executing user code, the time spent executing system code, the time spent in the foreground, and the number of times a process has been started.
Upvotes: 1
Reputation: 3748
The market only gives you the number of times downloaded and the total install base (i.e. count of users who have not uninstalled the application).
There are a variety of third party dlls that you can use to provide you with analytics regarding app usage.
Flurry is one. AdMob, now owned by Google, is another.
Upvotes: 0