code: public static boolean checkForRunningService(Context ctx, String serviceClassName) {
          ActivityManager manager = (ActivityManager) ctx.getSystemService(Context.ACTIVITY_SERVICE);
          for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
              if (serviceClassName.equals(service.service.getClassName())) {
                  return true;
              }
          }
          return false;
      }
docs: Check for a running service
  
  @param ctx                   the application context
  @param serviceClassName      the service class name
  @return      true if service is running, false overwise