我试图获取所有当前正在运行的应用程序,我试图做到这一点是这样的:
I am trying to fetch all the currently running apps and i am trying to do it like this:
try
{
List<ActivityManager.RunningAppProcessInfo> tasks = am.getRunningAppProcesses();
}
catch (SecurityException e)
{
//Something
}
但每次我试图在模拟器它给我强制关闭错误信息运行它。
But every time i am trying to run it on emulator it's giving me force close error message.
它需要的权限在AndroidManifest.xml中设置:
It need permission to be set in the AndroidManifest.xml:
<uses-permission android:name="android.permission.GET_TASKS" />