Initialize Gameball Customer Profile
Show your customers' profile including all details and progress on your Flutter app.
Last updated
Show your customers' profile including all details and progress on your Flutter app.
Last updated
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 guide, or as this section elaborates, through using our Gameball Flutter 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.
To show the Gameball customer profile that contains their details, available reward campaigns, and the leaderboard use showProfile() SDK method.
Gameball’s views are accessible through the code below. You just need to use it on any button action.
Parameter | Type | Required | Description |
| BuildContext | Yes | BuildContext instance which will be used in showing the customer's profile. |
| String | Yes | Unique identifier for the Customer in your database. Could be database ID, random string, email or anything that uniquely identifies the customer. |
| String | No | |
| Boolean | No | |
| Boolean | No | Flag for showing/hiding the close button from the player profile view. True by default |
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.
Parameter | Type | Required | Description |
| String | Yes | Unique identifier for the customer in your database. Could be database ID, random string, email or anything that uniquely identifies the customer. |
| String | No | Customer's unique Email address. |
| String | No | Customer's unique Mobile number. |
| object | No | PlayerAttributes is a builder class with set of properties that you want to set for the customer. |
| function | No | 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's side. You may consider enriching your Gameball's customer profile with attributes that are not available to the UI by using server side Create\Update Customer API
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.
Parameter Name | Type | Required |
---|---|---|
| string | No |
| string | No |
| string | No |
| string | No |
| string | No |
| string | No |
| string | No |
| string | No |
| string (ex: en, fr, ar) | No |
| Map<string, string> | No |
Note that if you set a Preferred Language, it will override the language value provided in the init method.
The previous example will return an object of PlayerAttributes with the configured attributes.
Using the previously created GameballApp instance or by creating a new one, call the registerPlayer() method as shown below