| 1 | 获取应用 | `ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);` | | 2 | 获取任务 | `List<ActivityManager.RunningTaskInfo>runningTasks = manager.getRunningTasks(1);` | | 3 | 获取活动 | `ComponentName componentName = runningTasks.get(0).topActivity;`...
ActivityManageractivityManager=(ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);List<ActivityManager.RunningAppProcessInfo>processInfos=activityManager.getRunningAppProcesses();StringpackageName=processInfos.get(0).processName; 1. 2. 3. 上述代码中,我们获取了ActivityManager的实例,然后调用getRunning...
13. public List<Programe> getRunningProcess(){ 14. PackagesInfo pi = new PackagesInfo(this); 15. 16. ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE); 17. //获取正在运行的应用 18. List<RunningAppProcessInfo> run = am.getRunningAppProcesses(); 19. //获取包管理器...
ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE); //获取正在运行的应用 List<RunningAppProcessInfo> run = am.getRunningAppProcesses(); //获取包管理器,在这里主要通过包名获取程序的图标和程序名 PackageManager pm =this.getPackageManager(); List<Programe> list = new ArrayList...
ActivityManager mActivityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); List<ActivityManager.RunningAppProcessInfo> appList = mActivityManager.getRunningAppProcesses(); for (RunningAppProcessInfo running : appList)
[Android.Runtime.Register("getRunningTasks", "(I)Ljava/util/List;", "GetGetRunningTasks_IHandler")] [System.Obsolete("deprecated")] public virtual System.Collections.Generic.IList<Android.App.ActivityManager.RunningTaskInfo>? GetRunningTasks (int maxNum); 參數 maxNum Int32 清單中要傳回的專案數上...
1、ActivityManager的getRunningTasks方法如下所示: frameworks/base/core/java/android/app/ActivityManager.java @SystemService(Context.ACTIVITY_SERVICE)publicclassActivityManager{...代码省略...publicList<RunningTaskInfo>getRunningTasks(intmaxNum)throwsSecurityException{returnActivityTaskManager.getInstance().getTasks(max...
publicArrayList<ProcessInfo>getRunningProcesses(Context context){ActivityManager am=(ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);List<ActivityManager.RunningAppProcessInfo>runningAppProcesses=am.getRunningAppProcesses();//获取运行中进程集合PackageManager pm=context.getPackageManager();ArrayL...
代码如下: ActivityManager am = (ActivityManager)context.getSystemService(Context.
[Android.Runtime.Register("getRunningServices", "(I)Ljava/util/List;", "GetGetRunningServices_IHandler")] public virtual System.Collections.Generic.IList<Android.App.ActivityManager.RunningServiceInfo>? GetRunningServices (int maxNum); 参数 ...