Gameball Developers Guide
v4.0
v4.0
  • Introduction
  • Installing Gameball
    • Web
      • Initialize Gameball Customer Widget
      • Track Customer Events
      • Track Orders & Cashback Reward
      • Integrate Redemption
      • Track Referrals
      • Go-Live Checklist
    • iOS
      • Getting Started
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Orders & Cashback Reward
      • Integrate Redemption
      • Push Notifications
      • Track Referrals
      • Go-Live Checklist
    • Android
      • Getting Started
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Orders & Cashback Reward
      • Integrate Redemption
      • Push Notifications
      • Go-Live Checklist
    • React Native
      • Getting Started
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Orders & Cashback Reward
      • Integrate Redemption
      • Track Referrals
      • Push Notifications
      • Go-Live Checklist
    • Flutter
      • Getting Started
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Orders & Cashback Reward
      • Integrate Redemption
      • Track Referrals
      • Go-Live Checklist
    • Generic Mobile App
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Orders & Cashback Reward
      • Integrate Redemption
      • Track Referrals
      • Push Notifications
  • REST API
    • Overview
      • What's New in V4.0
      • Authentication
      • Rate Limiting
      • Status and Error Codes
    • Customers
      • Customer Management
      • Customer Progress
      • Customer Tags
      • Customer Notifications
    • Events
    • Order
      • Order Tracking
      • Order Rewards & History
    • Payment
      • Payment Tracking
    • Transactions
      • Cashback & Redemptions
      • Hold Management
      • Transaction Management
      • Transaction Validation
    • Coupons
    • Configurations
      • Reward Configurations
      • Program Configurations
      • Widget Configuration
    • Leaderboard
    • Batches
      • Batch Creation
      • Batch Management
  • Webhooks
    • Overview
    • Subscribing to Webhooks
    • Webhook Topics
      • Customer's Notifications
      • Customer's Profile Updates
  • Tutorials
    • Tracking Customer Events
    • Redemption Integration
      • Direct debit redemption
      • Coupons Redemption
        • Use Your Own Couponing Engine
        • Gameball Couponing Engine
    • Checkout Integration
    • Build Custom UI Elements
      • Reward Campaigns
      • VIP Tiers
      • Customer Balance
      • Widget Configurations
      • Coupons Customer Experience
      • Customer Notifications
      • Customer Leaderboard
    • Build your Own Notification System
    • Channel Merging Guide
    • Previewing Potential Points Before Purchase
    • Refund
    • Retail & POS Integration with Gameball Loyalty Program
    • Referrals
    • Widget Deep Links
    • Batch APIs usage example
  • Branch.io Integration
  • Adjust Integration
Powered by GitBook
On this page
  • Showing Gameball Customer Profile
  • Change Customer Profile Widget language
  • Register/Update Customer
  • Register the Customer
  1. Installing Gameball
  2. Android

Initialize Gameball Customer Profile

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

PreviousGetting StartedNextTrack Customer Events

Last updated 27 days ago

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 👑. 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: ) 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}");
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.


customerId 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.

Open Detail Values
Value
View

details_referral

Navigates to the referral page directly.

details_redeem_coupons

Navigates to the coupons tab directly in the redeem page.

details_reward_campaign

Navigates to the reward campaigns page directly listing all the available reward campaigns.

details_reward_campaign_{CampaignId}

Navigates to a specific reward campaign details showing its progress.

details_wheels_list

Navigates to Wheels' list page directly.

details_wheel

Navigates to the first wheel details available from the wheels' list.

details_wheel_{WheelId}

Navigates to a specific Wheel Campaign with the given Id.

details_slot_list

Displays the list of available Slot Machines.

details_slot

Navigates to the first Slot Machine details available from the slots' list.

details_slot_{SlotId}

Opens a specific Slot Machine by its ID.

details_calendar_list

Displays the list of available Calendar campaigns.

details_calendar

Navigates to the first Calendar campaign details available.

details_calendar_{CalendarId}

Opens a specific Calendar campaign by its ID

details_scratch

Navigates to the first Scratch and Win available.

details_scratch_{scratchId}

Opens a specific Scratch and Win by its ID.

details_match

Navigates to the first Match game available.

details_match_{matchId}

Opens a specific Match game by its ID.


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 registerCustomer 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 Deprecated Required

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


intent Intent Deprecated Required

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


customerId 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.


customerEmail string Optional

Customer's unique Email address.


customerMobilestring Optional

Customer's unique Mobile number.


customerAttributes object Optional

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

customerAttributes 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.


referralCode string Optional

Customer's referree's referral code


isGuest boolean Optional

Flag indicating the customer is guest or not (if null, isGuest is set to false by default)


callback function Optional

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

Choose an Unchangeable Customer ID

Gameball user profile gets created using the customerId. 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.

An example to create CustomerAttributes object

CustomerAttributes customerAttributes = new CustomerAttributes.Builder()
        .withDisplayName("John Doe")
        .withFirstName("John")
        .withLastName("Doe")
        .withMobileNumber("0123456789")
        .withPreferredLanguage("en")
        .withCustomAttribute("{key}", "{Value}")
        .withAdditionalAttribute("{key}", "{Value}")
        .build();
val playerAttributes = CustomerAttributes.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 CustomerAttributes with the configured attributes.

Register the Customer

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

Since Firebase Dynamic Links will soon to be deprecated, we've deprecated its usage on our side, and started depending on either Branch.io or Adjust providers to provide for referral links, depending on your implementation, you should be able to fetch the referralCode from the sent query param GBReferral and provide it to the register customer methood

gameballApp.registerCustomer(
    "{customerId}", 
    customerAttributes,
    "{referralCode}",
    false, //isGuest
    new Callback<CustomerRegisterResponse >() {
        @Override
        public void onSuccess(CustomerRegisterResponse customerRegisterResponse ) {
            // TODO Handle on success result.
        }
    
        @Override
        public void onError(Throwable e) {
            // TODO Handle on failure result.
        }
});

//Overloaded with Email and Mobile Number
gameballApp.registerCustomer(
    "{customerId}", 
    "{customerEmail}",
    "{customerMobile}",
    customerAttributes, 
    "{referralCode}",
    false, //isGuest
    new Callback<CustomerRegisterResponse >() {
        @Override
        public void onSuccess(CustomerRegisterResponse customerRegisterResponse ) {
            // TODO Handle on success result.
        }
    
        @Override
        public void onError(Throwable e) {
            // TODO Handle on failure result.
        }
});
gameballApp.registerCustomer(
    "{customerId}", 
    customerAttributes,
    "{referralCode}",
    false, //isGuest
    object: Callback<PlayerRegisterResponse> {
            override fun onSuccess(t: PlayerRegisterResponse?) {
                // TODO Handle on success result.
            }

            override fun onError(e: Throwable?) {
                 // TODO Handle on failure result.
            }
})

//Overloaded with Email and Mobile Number
gameballApp.registerCustomer(
    "{playerUniqueId}",
    "{playerEmail}",
    "{playerMobile}",
    customerAttributes,
    "{referralCode}",
    false, //isGuest
    object: Callback<PlayerRegisterResponse> {
            override fun onSuccess(t: PlayerRegisterResponse?) {
                // TODO Handle on success result
            }

            override fun onError(e: Throwable?) {
                 // TODO Handle on failure result.
            }
})

Deprecated Register Customer overloads

Due to the deprecation of Firebase Dynamic Links in the old manner, we've updated the usage approach. If you still need to use the old method, you'll have to use the alternative handleFirebaseDynamicLink method to retrieve the referral code as before.

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

//Overloaded with Email and Mobile Number
gameballApp.registerCustomer(
    "{customerId}", 
    "{customerEmail}",
    "{customerMobile}",
    customerAttributes, 
    this, 
    this.getIntent(), 
    new Callback<CustomerRegisterResponse>() {
        @Override
        public void onSuccess(CustomerRegisterResponse customerRegisterResponse) {
            // TODO Handle on success result.
        }
    
        @Override
        public void onError(Throwable e) {
            // TODO Handle on failure result.
        }
});
gameballApp.registerCustomer(
    "{customerId}", 
    customerAttributes, 
    this, 
    this.getIntent(), 
    object: Callback<CustomerRegisterResponse> {
            override fun onSuccess(t: CustomerRegisterResponse?) {
                // TODO Handle on success result.
            }

            override fun onError(e: Throwable?) {
                 // TODO Handle on failure result.
            }
})

//Overloaded with Email and Mobile Number
gameballApp.registerCustomer(
    "{customerId}", 
    "{customerEmail}",
    "{customerMobile}",
    customerAttributes, 
    this, 
    this.getIntent(), 
    object: Callback<CustomerRegisterResponse> {
            override fun onSuccess(t: CustomerRegisterResponse?) {
                // TODO Handle on success result.
            }

            override fun onError(e: Throwable?) {
                 // TODO Handle on failure result.
            }
})

handleFirebaseDynamicLink method

gameballApp.handleFirebaseDynamicLink(
    this, 
    this.intent, 
    new Callback<String>() {
        @Override
        public void onSuccess(String referralCode) {
            // Capture the referral code using firebase dynamic link 
            // and begin the registration flow using the newer overloads
        }
    
        @Override
        public void onError(Throwable e) {
            // TODO Handle on failure result.
        }
});
gameballApp.handleFirebaseDynamicLink(
    this, 
    this.intent, 
    object: Callback<String>{
            override fun onSuccess(p0: String?) {
            // Capture the referral code using firebase dynamic link 
            // and begin the registration flow using the newer overloads
            }

            override fun onError(p0: Throwable?) {
                TODO("Not yet implemented")
            }
        })

Every time the SDK is initialized with a new customerId, 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

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

Configurations API
FAB
Create\Update Customer API
here