Пример #1
0
  public static boolean isSuspendable(Context context) {
    String act = Helper.getCurrentWorkingActivityName(context);
    final String[] internalActs = {"Preferences", "TitleListManagerActivity"};

    for (final String chkAct : internalActs) {
      if (Helper.stringContains(act, chkAct)) {
        return false;
      }
    }

    return true;
  }
Пример #2
0
  public static boolean checkServiceIsRunning(Context context) {
    ActivityManager actMgr = (ActivityManager) context.getSystemService(Service.ACTIVITY_SERVICE);
    List<ActivityManager.RunningServiceInfo> services =
        actMgr.getRunningServices(Integer.MAX_VALUE);

    if (!services.isEmpty()) {
      for (ActivityManager.RunningServiceInfo service : services) {
        String s = service.service.getShortClassName();

        if (Helper.stringContains(s, "ListStateUpdaterService")) {
          return true;
        }
      }
    }

    return false;
  }