Android SDK
Install and use the GrowSurf Android SDK to capture referral attribution, create referred participants, and show a native referral window in your app.
Install
The core library is lightweight, adding roughly ~1 MB to your Android app (attribution adapters add only tens of KB each).
Your app must use minSdk 24 or higher and compileSdk 36 or higher. Set targetSdk separately, to the level Google Play currently requires for app updates.
Add the core SDK from Maven Central. Choose one install path.
repositories {
mavenCentral()
}
dependencies {
implementation("com.growsurf:growsurf-android-sdk:0.4.0")
}repositories {
mavenCentral()
}
dependencies {
implementation 'com.growsurf:growsurf-android-sdk:0.4.0'
}If you use Branch, Adjust, AppsFlyer, or Singular, add the matching GrowSurf adapter.
dependencies {
implementation("com.growsurf:growsurf-android-sdk-attribution-branch:0.4.0")
implementation("com.growsurf:growsurf-android-sdk-attribution-adjust:0.4.0")
implementation("com.growsurf:growsurf-android-sdk-attribution-appsflyer:0.4.0")
implementation("com.growsurf:growsurf-android-sdk-attribution-singular:0.4.0")
}dependencies {
implementation 'com.growsurf:growsurf-android-sdk-attribution-branch:0.4.0'
implementation 'com.growsurf:growsurf-android-sdk-attribution-adjust:0.4.0'
implementation 'com.growsurf:growsurf-android-sdk-attribution-appsflyer:0.4.0'
implementation 'com.growsurf:growsurf-android-sdk-attribution-singular:0.4.0'
}Initialize
Enable Mobile SDK access in your GrowSurf program on the instructions page, then configure the SDK once when your app starts or before your first GrowSurf call.
Find
campaignIdin your GrowSurf program dashboard. It is the 6-character program ID, such asp9josq.Find
publicKeyin Program Editor > 5. Installation > Instructions page > Step 1. Android > Configure SDK.
Track referrals
Tracking referrals entails capturing attribution and creating new referred participants.
Capture attribution
Capture referral attribution before you create the referred friend's participant record.
For direct app links that open your installed app:
For deferred deep links from an attribution provider:
View Adapter docs for your specific provider setup instructions.
Create a referred participant
Use addReferredParticipant() for referred signups. This is typically where new users sign up in your app.
The SDK validates saved, explicit, or Play Install Referrer attribution and only creates the participant when the referral code is valid.
Generate referral links for your users
Generating referral links to users in your app entails generating a participant token by using the GrowSurf API, then opening the GrowSurf window.
Generate a participant token
To allow authenticated access to your logged-in users, you must call the GrowSurf backend to generate a participant token.
Call backend endpoint create a mobile participant token.
Here is an example cURL command:
Only email is required. firstName, lastName, mobileInstanceId, and ipAddress are optional participant fields. metadata is optional and is not used by GrowSurf.
Optional: To get the SDK-generated mobileInstanceId, use getMobileInstanceId().
This will create a new participant or return an existing one, along with a participant token that allows authenticated calls.
Pass it to the app, then store in the SDK via setParticipantToken().
Here is example SDK code:
Show the GrowSurf window



The GrowSurf window allows your participants to view/share their referral link and track the status of their referrals and rewards.
Call presentGrowSurfWindow() from your own button, menu item, or referral screen. Set the identity parameter to GrowSurfWindowIdentity.ExistingParticipantToken(), which will use the participant token you generated above.
[Optional] Google Contacts invites



Only needed when Google Contacts invites are enabled for your program. When a participant taps the Google Contacts button, the GrowSurf window takes them through Google's sign-in to grant access to their contacts (read-only) — the same experience as on iOS.
Unlike iOS, there is no in-app code to add on Android: the required Google Sign-In library is bundled with the SDK, and there is no URL scheme or URL forwarding to configure. The only requirement is a correctly configured Google Cloud OAuth client for your app.
Create an Android OAuth client as part of the Google Cloud setup. Set the application type to Android and register it with your app's package name and its SHA-1 signing-certificate fingerprint. Without this, the consent screen fails with a DEVELOPER_ERROR.
Get your SHA-1 fingerprint. The quickest way is the Gradle signing report, which prints the SHA-1 for every build variant:
Or read it directly from a keystore with keytool:
Register both your debug and release SHA-1 fingerprints so Google Contacts works in development and production.
Using Google Play App Signing? Register the SHA-1 of the app signing key shown in Play Console → Test and release → App integrity → App signing key certificate — not just your upload key. Otherwise the consent screen will fail in production even after the steps above.
Log out
If your user logs out of your app, call shutdown() to remove all participant data from the device:
Next steps
Attribution ProvidersAPI ReferenceModels and ErrorsGetting Started for Native MobileLast updated
Was this helpful?