Here you can find the source of getCurProcess(Context context)
public static final RunningAppProcessInfo getCurProcess(Context context)
//package com.java2s; //License from project: Apache License import java.util.List; import android.app.ActivityManager; import android.app.ActivityManager.RunningAppProcessInfo; import android.content.Context; public class Main { public static final RunningAppProcessInfo getCurProcess(Context context) { final int pid = android.os.Process.myPid(); final ActivityManager mActivityManager = (ActivityManager) context .getSystemService(Context.ACTIVITY_SERVICE); final List<RunningAppProcessInfo> runningAppProcesses = mActivityManager .getRunningAppProcesses(); RunningAppProcessInfo result = null; for (ActivityManager.RunningAppProcessInfo appProcess : runningAppProcesses) { if (appProcess.pid == pid) { result = appProcess;/*from w w w .j a v a2 s. co m*/ break; } } return result; } }