@Override
  protected void onPause() {
    App.getBus().unregister(this);

    if (scan_task != null) {
      scan_task.cancel(true);
    }
    scanning = false;
    super.onPause();
  }
  @Override
  protected void onResume() {

    super.onResume();

    if (App.getPassStore().isEmpty()) {
      scan_task = new ScanForPassesTask();
      scan_task.execute();
    }

    updateUIToScanningState();

    Tracker.get().trackEvent("ui_event", "resume", "passes", (long) App.getPassStore().passCount());

    App.getBus().register(this);

    refreshPasses();
  }