/** This method clears the current account address and launches Login Activity */
  public void logout() {

    // Remove current device on the backend so notifications are not sent to it
    ThreadManager.execute(
        new RemoveCurrentDeviceRunnable(
            (ZeppaApplication) getApplication(), getGoogleAccountCredential()));

    // Restore all singleton instances.
    EventTagSingleton.getInstance().restore();
    NotificationSingleton.getInstance().restore();
    ZeppaEventSingleton.getInstance().restore();
    ZeppaUserSingleton.getInstance().restore();

    // Clear logged in prefs
    getSharedPreferences(Constants.SHARED_PREFS, MODE_PRIVATE)
        .edit()
        .remove(Constants.LOGGED_IN_ACCOUNT)
        .commit();
    getSharedPreferences(Constants.SHARED_PREFS, MODE_PRIVATE)
        .edit()
        .remove(Constants.LOGGED_IN_USER_ID)
        .commit();

    // Return to Login activity
    Intent toLogin = new Intent(this, LoginActivity.class);
    startActivity(toLogin);
    finish();
  }
  public void onNotificationReceived(ZeppaNotification notification) {
    Toast.makeText(
            this,
            NotificationSingleton.getInstance().getNotificationMessage(notification),
            Toast.LENGTH_SHORT)
        .show();

    // Event Canceled
    if (NotificationSingleton.getInstance().getNotificationTypeOrder(notification) == 5) {
      ZeppaEventSingleton.getInstance().removeEventById(notification.getEventId());
      ZeppaEventSingleton.getInstance().notifyObservers();

    } else if (notification.getType().equalsIgnoreCase("EVENT_RECOMMENDATION")
        || notification.getType().equalsIgnoreCase("DIRECT_INVITE")) {
      ZeppaEventSingleton.getInstance().notifyObservers();
    }
  }