Initialize Gameball Customer Profile

Show your customer's profile including all details and progress on your Android app.

Showing the Gameball widget on your mobile application is slightly different than showing it on the website. You have two options; first, if you want to design your customer interface, you will use our set of REST APIs. To know more information, you can use the Configurations API 👑. The other option as this section elaborates, is through using our Android SDK.

Using the SDK, you can open the Gameball customer profile with the magic of a press of button in your app, programmatically when someone does a specific action, or from a persistent button (ex: FAB) that sits over your app’s UI.

When you trigger the Gameball customer profile, your customer is presented with a default screen that is configurable inside Gameball to change the look and feel of it.

From there, your customer can check their progress across different Gameball programs as per your configurations.

Showing Gameball Customer Profile

To show the Gameball customer profile that contains their details, available reward campaigns, and the leaderboard use showProfile() SDK method.

gameballApp.showProfile(this, "{CUST_ID}", "{openDetail}", "{hideNavigation}");

Use showProfile as a parameter to collect the activity or the fragment you are going to show the profile in. Just create a button and call this method in the onClick() method of this button.

The below is description of show customer profile parameters

activity Activity Required

Current activity instance holding the GameballApp which will be used in showing the customer's profile.


playerUniqueId string Required

Unique identifier for the customer that you can reference across the customer’s whole lifetime. Could be a database ID, random string, email or anything that uniquely identifies the customer.


openDetail string Optional

Specify if you want the widget to open on a specific view. Possible values are:

  • details_referral

  • details_reward_campaign

  • details_reward_campaign_{RewardID}

  • details_wheels_list

  • details_wheel


hideNavigation Boolean Optional

Set to true to stop widget navigation otherwise leave as null

Change Customer Profile Widget language

changeLanguage(String language)

Use changeLaguage SDK method to change the widget language. 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".

Register/Update Customer

To register your customers with Gameball, use registerPlayer method which can be used to create or update the customer details at Gameball. Ideally, it is called when your login or register network call is successful.

activity Activity Required

Current activity instance holding the GameballApp which will be used in showing the customer's profile.


intent Intent Required

An intent instance that will be used in combination with the Activity to detect the referral code from the dynamic link.


playerUniqueId string Required

Unique identifier for the customer that you can reference across the customer’s whole lifetime. Could be a database ID, random string, email or anything that uniquely identifies the customer.


playerEmail string Optional

Customer's unique Email address.


playerMobile string Optional

Customer's unique Mobile number.


playerAttributes object Optional

Additional customer-specific attributes. Includes attributes such as the customer’s name, contact details, and purchase history.

playerAttributes Object

withDisplayName string Optional

The display name of the customer.


withFirstName string Optional

The first name of the customer.


withLastName string Optional

The last name of the customer.


withEmail string Optional

Customer's unique Email address.


withMobileNumber string Optional

Customer's unique Mobile number.


withGender string Optional

The gender of the customer. Use "M" for male, "F" for female, or other identifiers as needed.


withDateOfBirth string Optional

The customer's date of birth in the format YYYY-MM-DD.


withJoinDate string Optional

The date the customer joined your system, in the format YYYY-MM-DD.


withPreferredLanguage string Optional

The language the customer prefers for receiving notifications.


withCustomAttribute Object Optional

Custom attributes related to the customer, defined by specific key-value pairs.rs.


withAdditionalAttribute Object Optional

Any additional attributes related to the customer, defined by specific key-value pairs.


callBack function Optional

Callback is used for providing the developer with the response status and payload.

Every time the SDK is initialized with a new playerUniqueId , the customer profile is created or updated on Gameball side. You may consider enriching your Gameball customer profile with attributes that are not available to the UI by using server side Create\Update Customer API

Choose an Unchangeable Customer 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 customer, you risk losing all original data for that customer and hence losing their points and rewards on Gameball. Accordingly, it is NOT recommended to use the email address or the mobile number as the unique ID as both can be changed by the user at anytime.

Note that if you set a Preferred Language, it will override the language value provided in the init method. If neither were provided, the device's default locale will be used.

You can find the complete list of Customer Attributes here, if its not included in the PlayerAttributes builder you can add them as Key/Value pairs using withAdditionalAtribute builder method and it will automatically added upon request.

An example to create PlayerAttributes object

PlayerAttributes customerAttributes = new PlayerAttributes.Builder()
        .withDisplayName("John Doe")
        .withFirstName("John")
        .withLastName("Doe")
        .withMobileNumber("0123456789")
        .withPreferredLanguage("en")
        .withCustomAttribute("{key}", "{Value}")
        .withAdditionalAttribute("{key}", "{Value}")
        .build();

The previous example will return an object of PlayerAttributes with the configured attributes.

Register the Customer

Using the previously created GameballApp instance or by creating a new one, call the RegisterPlayer() method as shown below

gameballApp.registerPlayer(
    "{customerId}", 
    customerAttributes, 
    this, 
    this.getIntent(), 
    new Callback<PlayerRegisterResponse>() {
        @Override
        public void onSuccess(PlayerRegisterResponse playerRegisterResponse) {
            // TODO Handle on success result.
        }
    
        @Override
        public void onError(Throwable e) {
            // TODO Handle on failure result.
        }
});

//Overloaded with Email and Mobile Number
gameballApp.registerPlayer(
    "{customerId}", 
    "{customerEmail}",
    "{customerMobile}",
    customerAttributes, 
    this, 
    this.getIntent(), 
    new Callback<PlayerRegisterResponse>() {
        @Override
        public void onSuccess(PlayerRegisterResponse playerRegisterResponse) {
            // TODO Handle on success result.
        }
    
        @Override
        public void onError(Throwable e) {
            // TODO Handle on failure result.
        }
});

Last updated