List of usage examples for android.app.usage UsageStatsManager INTERVAL_BEST
int INTERVAL_BEST
To view the source code for android.app.usage UsageStatsManager INTERVAL_BEST.
Click Source Link
From source file:research.sg.edu.edapp.kb.KbSoftKeyboard.java
public String getTopPackage() { RecentUseComparator mRecentComp = new RecentUseComparator(); long ts = System.currentTimeMillis(); UsageStatsManager mUsageStatsManager = (UsageStatsManager) getSystemService(Context.USAGE_STATS_SERVICE); List<UsageStats> usageStats = mUsageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_BEST, ts - 1000 * 10, ts);//from www .j a va 2 s . com if (usageStats == null || usageStats.size() == 0) { //return NONE_PKG; return old_pkg; } Collections.sort(usageStats, mRecentComp); old_pkg = usageStats.get(0).getPackageName(); return usageStats.get(0).getPackageName(); }