Android UsageStatsManager: Get a list of currently running apps on phone
问题 I am trying to get a list of currently running apps on my phone. Here is the code I am using: if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { UsageStatsManager usm = (UsageStatsManager)this.getSystemService(Context.USAGE_STATS_SERVICE); long time = System.currentTimeMillis(); List<UsageStats> appList = usm.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, time - 10000*10000, time); if (appList != null && appList.size() == 0) { Log.d("Executed app", "########