Skip to main content

Open the Gameball Profile Widget

Use the Gameball profile widget to show customers their points, rewards, tiers, leaderboards, and history inside your Android app.
Before showing the profile widget, make sure the SDK is initialized and the customer has been registered using Initialize SDK and Initialize Customer Profile.

Basic Usage

Create a ShowProfileRequest and call showProfile from GameballApp.
🔒
Secure API Access: To benefit from v4.1 secure API endpoints, pass the sessionToken parameter when showing the profile widget (required in upcoming SDK v4). This enables automatic routing to v4.1 secure endpoints. Learn more about v4.1 →

Request Parameters

string
Unique identifier for the customer whose profile will be displayed. Optional (omit for guest mode).
string
Specific section to open inside the widget (for example, "details_earn", "details_redeem"). If not set, the main profile view opens by default.
boolean
Hides the widget navigation bar when set to true. Defaults to false.
boolean
Shows a close button within the widget when set to true. Defaults to false.
string
Hex color string for the close button (for example, "#FF5733").
Only applies when showCloseButton is true.
string
Optional session token to override the global token for this specific request. Required in upcoming SDK v4.
string
Customer mobile number, used for channel merging. Available from v3.2.0.
string
Customer email address, used for channel merging. Available from v3.2.0.
Handler for links the widget tags with gbExternalBrowser=true. When provided, the link is delegated to your app; otherwise the SDK opens it in the system browser. Available from v3.2.0.
Callback<Map<String, Object>>
Receives events the widget posts, such as game completion. Available from v3.2.0.

Validation Rules

No required fields (guest mode supported). Provide customerId for authenticated profiles.

Advanced Configuration

Open a Specific Section

Use openDetail to deep link into a specific section (for example, “earn” details):

Guest Mode (v3.1.1+)

Custom Close Button

Show a custom-colored close button on the widget:

Hide Navigation

Often paired with openDetail to guide users to a specific section when navigation is hidden.
Hide the widget’s internal navigation controls:
Links the widget tags with gbExternalBrowser=true open in the system browser by default. Provide an externalLinkCallback to handle them yourself instead (for example, to open an in-app browser or route to a custom screen):
When externalLinkCallback is set, the SDK delegates the link to your app and does not open the system browser.

Channel Merging (v3.2.0+)

Pass the customer’s mobile and email so Gameball can merge the customer’s channels:

Widget Events (v3.2.0+)

Pass a widgetEventCallback to react to events the widget posts, such as a customer finishing a game. Each event arrives as a Map<String, Object> with a top-level type and a nested metadata map:

gameCompleted Metadata

All gameCompleted values arrive as String or Boolean. There are no numeric fields.

Dismiss the Widget (v3.2.0+)

Dismiss the widget programmatically from your app. The call is a no-op when no widget is showing:
The widget can also dismiss itself from the web side by calling window.GameballWidget.closeWidget().

Implementation Examples

Show Profile from a Button

Display the profile widget when the user taps a button.

Bottom Navigation Integration

Open the profile widget when the user taps a “Rewards” tab:

What the Widget Shows

The profile widget typically includes:

Customer Info

Display name, points balance, and tier level.

Reward Campaigns

Available rewards, missions, and how to earn them.

Leaderboard

Customer ranking and top performers.

Transaction History

History of points earned and redeemed.
The content, layout, and branding of the profile widget can be configured from your Gameball dashboard.

Best Practices

1

Make Access Easy

Place entry points to the profile widget in prominent locations (for example, main navigation, profile screen, or a dedicated Rewards tab).
2

Use Badges

Show badges or indicators when a customer has new rewards or achievements to view.
3

Use Deep Linking

Use the openDetail parameter to open specific sections based on context (for example, after checkout, open the rewards section).
4

Handle Errors Gracefully

Always implement the error callback to show friendly messages if the widget fails to load (for example, due to network issues).
Consider showing the profile widget immediately after a customer earns points or unlocks a reward to reinforce engagement.