Skip to main content

Identify users

Rewards belong to a user, so identify the user as soon as you know who they are. Before that, the SDK tracks the device as an anonymous visitor, and that history is linked to the user when you identify them.

Returning users​

Flyy.setUser("user-1001")
Flyy.setUser("user-1001", "segment-premium") // with a segment
Flyy.setUser("user-1001") { ok -> /* identified */ }

New signups​

Use the new-user call so signup campaigns and referrals trigger. To credit a referrer as well, use setUserWithReferralCode — see Referrals.

Flyy.setNewUser("user-1001")

:::warning Production apps Don't identify users with a plain user id in production. Anyone who knows an id could act as that user. Have your backend exchange the id for a user token using the Flyy partner API, return the token to the app, and pass it to the SDK. :::

Flyy.setUserToken(tokenFromYourBackend) // returning user
Flyy.setNewUserToken(tokenFromYourBackend) // new signup

// or at start:
Flyy.start(this) { partnerId = "…"; userToken = tokenFromYourBackend }

Profile details​

Optional. Shown on leaderboards and used for payouts.

Flyy.loginUser("user-1001", "Asha Rao") // identify + name in one call
Flyy.setUsername("Asha Rao")
Flyy.setDisplayName("Asha")
Flyy.setContactNumber("+919800000000")
Flyy.addUserToSegment("Premium", "premium")

Sign-out​

Flyy.logout()

What happens after you identify​

Each successful identify does the same three things on both platforms:

  1. refreshes app info (campaigns, theme, placements for this user's segments),
  2. checks for pending scratch cards and shows the scratch popup if there is one,
  3. re-sends the push token so notifications reach this user.

Failed calls are queued and retried while offline. Completion callbacks run only on a real success — never on failure, and never before init.