开发者

How to get info Last Run Time, or How Many Times and App has been Executed or Run?

Does Android OS store info on Apps like last run开发者_如何学Go time, or how many times an app was run?


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.


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.


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();  
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜