@Override
  public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
    if (key.equals("USE_GPS")) {
      if (mSettings.isGpsTrackingEnabled()) {
        stopScheduledLocationUpdates();
        startScheduledLocationUpdates();
      } else {
        stopScheduledLocationUpdates();
      }
      return;
    }

    if (key.equals("GPS_TIMER") || key.equals("GPS_ONLY_NEW")) {
      stopScheduledLocationUpdates();

      if (mSettings.isGpsTrackingEnabled()) {
        startScheduledLocationUpdates();
      }
      return;
    }

    if (key.equals("GPS_HIDDEN")) {
      mIsGpsHidden = mSettings.isGpsHidden();
      if (mIsGpsHidden) {
        if (ScreenStateReceiver.getScreenState() != ScreenStateReceiver.SCREEN_STATE_OFF) {
          stopGpsListeners();
        }
      } else {
        startGpsListeners();
      }
      return;
    }
  }
  public synchronized void start() {
    LocalBroadcastManager.getInstance(mContext)
        .registerReceiver(mScreenStateReceiver, new IntentFilter(ScreenStateReceiver.SCREEN_EVENT));

    if (mSettings.isGpsTrackingEnabled()) {
      startScheduledLocationUpdates();
    }
  }