Referrals Module on Android

Configure the referral module on your Android app using Firebase. This module allow users or players to refer others with a referral link and gain points.

Configure Gameball With Your Firebase

Before you start, you must configure your Firebase on your Gameball account. Follow the steps in Configure your Firebase account on Gameball for mobile friends referral links article in our Help Center to configure your Firebase account on Gameball.

Integration Details

Below are FireBase dynamic links configuration details.

  • Add the firebase dynamic links dependency in your project

implementation 'com.google.firebase:firebase-dynamic-links:17.0.0'
  • In your manifest file add an intent filter in the activity that handles the deep links

<intent-filter>
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <data
        android:host="example.com"
         android:scheme="https"/>
</intent-filter>

For more information check Firebase Docs: https://firebase.google.com/docs/dynamic-links/android/receive

Referral Methods

addReferral(Activity activity, Intent intent)

This should be called after your users registration and the creation of a new user and hence a new player on Gameball. It basically detects if the user has registered using a referral code or not. Generally, it should be called in the onSucess fo registerPlayer method.

Firebase dynamic links integration

  • Add the firebase dynamic links dependency in your project: implementation ‘com.google.firebase:firebase-dynamic-links:17.0.0′

  • In your manifest file add an intent filter in the activity that you are going to call addReferral

<intent-filter>
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <data
        android:host="example.com"
         android:scheme="https"/>
</intent-filter>

Now referral links will be generated successfully for your players!

Last updated