Getting Started
Install the Gameball Android SDK into your app
The Gameball SDK for Android enables you to use the show Gameball player profile in your app, track app player events, integrate referrals and display Gameball's in-app push notifications.

Installation

Follow the below steps to start installing the Android SDK to your app
    Add the JitPack repository to your build file.
1
type to enter textallproject {
2
repositories {
3
……
4
maven { url "https://jitpack.io" }
5
}
6
}
Copied!
    Add Gameball dependency to your app gradle module
    If you are using Android X use the following
1
implementation 'com.github.gameballers:gb-mobile-android:1.1.1'
Copied!
If you will be using the SDK to show Gameball's push notifications and Track Referrals
    Add Firebase dependencies if they dont exist in your gradle Module

Initialization

To initialize Gameball SDK in your application class, use the init method which takes 4 parameters:
Parameter
Type
Required
Description
APIKey
string
Yes
Client API key
playerUniqueId
string
Yes
Unique identifier for the player in your database.
Could be database ID, random string, email or anything that uniquely identifies the player.
notificationIconId
string
Yes
The ID of the icon you want to use for notification
lang
string
No
Your platform language preference to view Gameball Widget with.
Note: The language provided should be as per configured languages in your account. If not provided the Gameball profile widget will be shown with your account default language
Example: "en", "fr".
1
GameBallApp.getInstance(getApplicationContext()).init("{{Your_API_Key}}",
2
playerUniqueId, R.mipmap.ic_launcher, lang);
Copied!
Everytime the SDK is initialized with a new playerUniqueId , the player profile is created or updated at Gameball side. You may consider enriching your Gameball's player profile with attributes that are not avialable to the UI by using server side Create\Update Player API
Choose an Unchangeable Player Unique ID
Gameball user profile gets created using the playerUniqueId. It is highly recommended to have the unique ID as an identifier that would NEVER be changed. If this unique ID changes for a given player, you risk losing all original data for that player and hence losing their points and rewards on Gameball. Accordingly, it is NOT recommended to use email address or mobile number as the unique ID as both can be changed by the user at anytime.

User Registration

You should register your players with Gameball. This can be done using registerPlayermethod which can be used to create or update the player details at Gameball. Ideally, it is called when your login or register network call is successful.
registerPlayer(PlayerUniqueId, PlayerTypeId, PlayerAttributes, CallBack)
Parameter
Required
Description
PlayerUniqueId
string
Required
Unique identifier for the player in your database.
Could be database ID, random string, email or anything that uniquely identifies the player.
PlayerTypeId
string
Optional
leave empty
PlayerAttributes
object
Optional
PlayerAttributes is a builder class with set of properties that you want to set for the player.
CallBack
function
Optional
callBack is used for providing the developer with the response status
PlayerAttributes Object
PlayerAttributes is a builder class and can be used as
1
= > new PlayerAttributes.Builder().withDisplayName(Jack).build();
Copied!
The previous example will return an object of PlayerAttributes with DisplayName “Jack”
To add custom attributes:
    Build PlayerAttributes instance first
    Use addCustomAttribute on the instance you have just created
    addCustomAttribute(String Key, String value)
      Key = one of the defined keys in your dashboard
      Value is a string format of your specified type of the corresponding key in your dashboard
Last modified 2mo ago