Gameball Developers Guide
v3.0
v3.0
  • Introduction
  • What's New in V3.0
  • Installing Gameball
    • Web
      • Show 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
      • Track Referrals
      • Push Notifications
      • Go-Live Checklist
    • Android
      • Getting Started
      • Initialize Gameball SDK
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Referrals
      • 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
      • Migration from v1 to v2
    • Flutter
      • Getting Started
      • Initialize Gameball SDK
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • 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
    • Retail & Modern POS
      • Initialize Gameball Customer Profile
      • Track Orders & Cashback Reward
      • Track Refunds
      • Enable Redemption
        • Prepare POS for Redemption
        • Using Virtual ID
          • Using Virtual Card
  • REST API
    • Overview
      • Server-Side SDKs
    • Authentication
    • API Reference
      • Customer
      • Event
      • Transactions
      • Order
      • Coupons
      • Leaderboard 👑
      • Notifications 👑
      • Configurations 👑
      • Batches 👑
        • Batch Operations Data
      • OTP
      • Partner 🤝
        • Client 🤝
        • Redemption Rule 🤝
        • Cashback Rule 🤝
    • Webhooks
      • Notifications Webhook
      • Customer Profile Webhook
    • Errors
    • Object Reference
  • Tutorials
    • Build Custom UI Elements 👑
      • Display Reward Campaign Progress
      • Show VIP Tiers
      • Show Customer Points Balance
      • Build Leaderboards
      • Show Notifications Inbox
      • Adapt UI to Configurations
      • Advanced UI Techniques
        • Increase Sales with Cashback UI Elements
        • Derive Engagement with Rewards Campaigns UI Elements
    • Tracking Customer Events
    • Build your Own Notification System
    • Checkout Integration Example
    • Redemption Integration Options
      • Redeem with coupon system
        • Integrate your coupon system
          • Example using e-commerce platform(WooCommerce)
          • Example using a custom coupon system
        • Build couponing experience
          • Using Gameball widget
          • Build custom experience
            • Showing customers available points
            • Allowing customers to create coupons
            • Apply the discount code to your cart
        • Coupon integration reference
      • Redeem with direct debt
        • Get customers points balance
        • Redeem customer points
  • Third Party Integrations
    • Segment Integration
Powered by GitBook
On this page
  • Showing Gameball Customer Profile
  • 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.

PreviousInitialize Gameball SDKNextTrack Customer Events

Last updated 6 months ago

Showing the Gameball widget on your mobile application is slightly different than showing it on the website. You can either design your own customer interface with the help of our REST APIs - to know more information, you can follow this , or as this section elaborates, through using our Gameball 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.

Parameter

Type

Required

Description

Activity

Activity

Yes

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

PlayerUniqueId

String

Yes

Unique identifier for the Customer in your database.

Could be database ID, random string, email or anything that uniquely identifies the customer.

openDetail

String

No

hideNavigation

Boolean

No

showCloseButton

Boolean

No

Flag for showing/hiding the close button from the player profile view. True by default

gameballApp.showProfile(this, "{playerUniqueId}", "{openDetail}", "{hideNavigation}");
gameballApp.showProfile(this, "{playerUniqueId}", "{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.

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

Parameter

Type

Required

Description

PlayerUniqueId

String

Yes

Unique identifier for the customer in your database.

Could be database ID, random string, email or anything that uniquely identifies the customer.

PlayerEmail

String

No

Customer's unique Email address.

PlayerMobile

String

No

Customer's unique Mobile number.

PlayerAttributes

object

No

PlayerAttributes is a builder class with set of properties that you want to set for the customer.

Activity

Activity

Yes

Current activity instance holding the GameballApp which will be used in the detection of the referal code from the dynamic link.

Intent

Intent

Yes

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

CallBack

function

No

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

Choose an Unchangeable PlayerUniqueId

Gameball customer gets created using theplayerUniqueId. 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, 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 customer at anytime.

PlayerAttributes Object

PlayerAttributes is a builder class that helps in creation of the PlayerAttributes with the common attributes mentioned below, all of these attributes are optional to use.

Method
Parameter Name
Type

withDisplayName

displayName

string

withFirstName

firstName

string

withLastName

lastName

string

withEmail

email

string

withGender

gender

string

withMobileNumber

mobileNumber

string

withDateOfBirth

dateOfBirth

string

withJoinDate

joinDate

string

withPreferredLanguage

preferredLanguage

string (ex: en, fr, ar)

withCustomAttribute

(key, value)

(string, string)

withAdditionalAttribute

(key, value)

(string, string)

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 PlayerAttributes object

PlayerAttributes playerAttributes = new PlayerAttributes.Builder()
        .withDisplayName("John Doe")
        .withFirstName("John")
        .withLastName("Doe")
        .withMobileNumber("0123456789")
        .withPreferredLanguage("en")
        .withCustomAttribute("{key}", "{Value}")
        .withAdditionalAttribute("{key}", "{Value}")
        .build();
val playerAttributes = 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(
    "{uniquePlayerId}", 
    playerAttributes, 
    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(
    "{uniquePlayerId}", 
    "{playerEmail}",
    "{playerMobile}",
    playerAttributes, 
    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.
        }
});
gameballApp.registerPlayer(
    "{playerUniqueId}",
    playerAttributes,
    this, 
    this.intent,
    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.registerPlayer(
    "{playerUniqueId}",
    "{playerEmail}",
    "{playerMobile}",
    playerAttributes,
    this, 
    this.intent,
    object: Callback<PlayerRegisterResponse> {
            override fun onSuccess(t: PlayerRegisterResponse?) {
                // TODO Handle on success result
            }

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

Every time the SDK is initialized with a new playerUniqueId , the customer profile is created or updated on Gameball's side. You may consider enriching your Gameball's 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 PlayerAttributes builder you can add them as Key/Value pairs using withAdditionalAtribute builder method and it will automatically added upon request.

here
guide
FAB
Create\Update Customer API