private boolean ensureUi() {

    SharedPreferences settings = getPreferences(MODE_PRIVATE);
    String tToken = settings.getString("4sqToken", "none");

    if (tToken != "none") {
      ExampleTokenStore.get().setToken(tToken);
    }

    boolean isAuthorized = !TextUtils.isEmpty(ExampleTokenStore.get().getToken());

    if (!isAuthorized) {
      Intent intent = FoursquareOAuth.getConnectIntent(MainActivity.this, CLIENT_ID);

      // If the device does not have the Foursquare app installed, we'd
      // get an intent back that would open the Play Store for download.
      // Otherwise we start the auth flow.
      if (FoursquareOAuth.isPlayStoreIntent(intent)) {
        Intent fourIntent = new Intent(MainActivity.this, DownloadFoursquare.class);
        startActivity(fourIntent);
        return false;
      } else {
        startActivityForResult(intent, REQUEST_CODE_FSQ_CONNECT);
        return true;
      }
    } else {
      SharedPreferences.Editor editor = settings.edit();
      editor.putString("4sqToken", ExampleTokenStore.get().getToken().toString());
      editor.commit();
      return true;
    }
  }