- Android 5.0 (API 21)+, Kotlin coroutines
- Depends only on
kotlinx-coroutinesand the Play Install Referrer library. No analytics and no background work - Uses only your Program ID, never your API key
Before you start
In Partnero, open Program settings and turn on Enable mobile app claims in the Tracking for mobile apps section. Until then, every claim fails withCodeNotFound.
Copy your Program ID from the program’s Integration page. It’s the same ID as in your PartneroJS snippet.
Install
Add the library from Maven Central to your app module’sbuild.gradle.kts:
Configure
Callconfigure once in your Application:
?aff= by default. If yours use another parameter, such as ?ref=DANIEL20, pass referralParameter = "ref".
Claim a code the user enters
Claim the code when the user enters one. Pass the ID your purchases are reported under, such as the RevenueCat app user ID. The claim functions suspend, so call them from a coroutine such aslifecycleScope.launch.
Purchases.sharedInstance.logIn(...), since anonymous IDs are rejected.
If a code is used as both a partner’s link key and a promotion code, say which one the user entered:
Claim from an opened link
When a partner app link or a referral link opens your app, pass theUri on:
intent.data in onCreate for links that start the app. The code is read from partnero_code, or from your referral parameter, such as https://example.com/?aff=DANIEL20. The click ID is read from partnero_click. It returns null without calling Partnero for links with neither.
If the user isn’t signed in yet, store the values and claim after sign-in:
Partnero.claimClick(clickId, appUserId).
Claim a Google Play install
When the program has no deep link and a Google Play link is set, app links send Android users to Google Play with the code and click ID in the install referrer. Partners can also share a Google Play link with their code in thereferrer parameter, URL-encoded:
null when the install didn’t come from a partner link. Each install’s referrer is claimed once. If Google Play can’t be reached, or the claim fails because of a rate limit, a server error or the network, the next call tries again. Other refusals, such as an unknown code, are final for that install, so turn on mobile app claims before you release.
Claim results and failures
claim returns a ClaimResult with a status:
Refusals are thrown as subclasses of
PartneroException:
When the request can’t reach Partnero, the SDK throws
IOException. It never retries on its own.
Privacy
The SDK sends Partnero the code, the click ID when there is one, the app user ID, the platform and the first launch date. It stores the first launch date inSharedPreferences, and whether the install referrer was claimed. It doesn’t read device identifiers. In your Google Play Data safety form, list the user ID as collected for App functionality if you don’t already.