How to check current running applications in Android?

You can get current name package using

ActivityManager am = (ActivityManager) mContext
                .getSystemService(Activity.ACTIVITY_SERVICE);
        String packageName = am.getRunningTasks(1).get(0).topActivity
                .getPackageName();

You can use this package name to get current active application


You can check the processName of each element in the list to see if it's the process you're looking for. You can use this code

boolean isNamedProcessRunning(String processName){
 if (processName == null) 
  return false;

 ActivityManager manager = 
    (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
 List<RunningAppProcessInfo> processes = manager.getRunningAppProcesses();
 for (RunningAppProcessInfo process : processes)
 {
    if (processName.equals(process.processName))
    {
        return true;
    }
 }
 return false;
}