public static String getProcessName(Context context) {
  ActivityManager actMgr = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
  List<RunningAppProcessInfo> appList = actMgr.getRunningAppProcesses();
  for (RunningAppProcessInfo info : appList) {
   if (info.pid == android.os.Process.myPid()) {
    return info.processName;
   }
  }
  return "unknown";
 }