コード例 #1
0
  public void userLogout() {
    prefs.edit().remove(PREF_EMAIL).apply();
    config.removeCustomField(HASHED_EMAIL);
    clear();

    tracker.publish("action:logout");

    // TODO: Call server
  }
コード例 #2
0
  public boolean userLogin(String email, String password) {
    // A real app would probably encrypt this value before persisting it
    prefs.edit().putString(PREF_EMAIL, email).apply();
    config.addCustomField(HASHED_EMAIL, Hashes.sha256(email));

    trackerWrapper.trackEvent(USER, LOGIN); // standard tracking
    tracker.publish("action:login"); // separate event for profile sync

    // TODO: Call server
    return true;
  }