I'm trying to list all running Apps but i don't know why i can't do it.
When i try to run the following command, i just have mine application returned.
List<ActivityManager.RunningAppProcessInfo> listProcesses = manager.getRunningAppProcesses();
Many sites tells to use
List<ActivityManager.RunningTaskInfo> alltasks = am.getRunningTasks(Integer.MAX_VALUE);
But also just returned my application
Is there anything to do without root to get all task/process running ?
As stated, getRunningTasks and getRunningAppProcesses are no longer supported starting with Android 5 (Lollipop)
For newer Android versions, you need to ask the user to grant you Apps Usage permission and then ask UsageStatsManager for the apps running in a certain period of time.
https://developer.android.com/reference/android/app/usage/UsageStatsManager.html
You have more details here:
How to use UsageStatsManager?
Here is a sample on how to query UsageStatsManager (credits to Cole Murray - posted in the previous link) - https://github.com/ColeMurray/UsageStatsSample
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With