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
  • Setting up Gameball SDK
  • To install Firebase Google Play Services dependencies
  • Initialization
  • Widget Parameters Description
  • Profile Languages
  • Initialize Push Notifications
  1. Installing Gameball
  2. Android

Getting Started

Install the Gameball Android SDK into your app

Gameball's Android SDK enables you to use the show Gameball customer profile in your app, track app customer events, integrate referrals and display Gameball's in-app push notifications.

Setting up Gameball SDK

Follow the below steps to start installing Gameball's Android SDK to your app.

Add JitPack and Huawei repositories to your project's build.gradle (or settings.gradle if you're on newer versions) file.

dependencyResolutionManagement {
    ...
    repositories {
        ...
        maven { url "https://jitpack.io" }
        maven { url 'https://developer.huawei.com/repo/' }
    }
}

Add the following dependency to the application's build.gradle file to import Gameball's SDK into your project.

dependencies {
    ...
    implementation 'com.github.gameballers:gb-mobile-android:2.2.0'  
}

Make sure that you added the INTERNET permission in your application's AndroidManifest.xml file as follows:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
    ...
    <uses-permission android:name="android.permission.INTERNET" />
    ...
</manifest>
    

To install Firebase Google Play Services dependencies

Gameball SDK uses Firebase Dynamic Links to track referrals and Firebase Messaging for sending push notifications, you'll need to add the following dependencies.

dependencies {
    ...
    // Make sure to include this dependency even if you won't include Firebase Messaging
    implementation platform('com.google.firebase:firebase-bom:<latest_version>')
    // Firebase Dynamic Links only - must be included
    implementation "com.google.firebase:firebase-dynamic-links"    
    // Firebase Messaging only - optional depending on whether or not you want to use FCM
    implementation 'com.google.firebase:firebase-messaging'  
}

You also need to add google-services plugin to your application.

App's build.gradle file:

plugins {
    ...
    id 'com.google.gms.google-services'
}

Project's build.gradle file:

buildscript{
    ...
    dependencies {
        ...
        classpath 'com.google.gms:google-services:<latest_version>'

    }
}

Don't forget to include your google-services.json to your app root after registering it to a Firebase project.

When publishing your app, make sure if you are using ProGuard rules, to exclude gameball packages to avoid Reductions/Code obfuscation by adding the following line in the proguard-rules.pro file.

-keep class com.gameball.gameball.** { *; }

Initialization

To create a GameballApp instance you need to call the getInstance method and pass it a Context instance of the current Activity holding the GameballApp.

GameballApp gameballApp = GameballApp.getInstance(getApplicationContext());
val gameballApp = GameballApp.getInstance(applicationContext)

Then initialize it as the following:

// Using the instantiated instance of GameballApp
gameballApp.init("{your API Key}", "{lang}", "{your Platform name}", "{your Shop name}");

//You can access the init method directly as follows
GameballApp.getInstance(getApplicationContext()).init("{your API Key}", "{lang}", "{your Platform name}", "{your Shop name}");
// Using the instantiated instance of GameballApp
gameballApp.init("{your API Key}", "{lang}", "{your Platform name}", "{your Shop name}")

//You can access the init method directly as follows
GameballApp.getInstance(applicationContext).init("{your API Key}", "{lang}", "{your Platform name}", "{your Shop name}")

Widget Parameters Description

APIKey string Required

The API key of the Client account


lang string Optional

The language that the SDK should be initialized with (based on the Client's configuration)


shop string Optional Shopify Only

Store name with myshopify.com domain. Used if your app is a mobile app for a Shopify store connected to Gameball


platform string Optional

The platform you application used:

  • Shopify

  • Salla

  • any

Profile Languages

For websites with multiple languages, how you can change Gameball widget language based on active website language. Gameball supports multiple languages for the customer profile widget. The widget language can be changed based on your customer's active language on the website.

Supported Languages & Codes

  • English: en

  • Arabic: ar

  • French: fr

  • Spanish: es

  • German: de

  • Portuguese: pt

  • Polish: pl

  • Italian: it

  • Hungarian: hu

  • Chinese (Traditional, Taiwan): zh-tw

  • Dutch: nl

  • Swedish: sv

  • Norwegian: no

  • Danish: dk

  • Japanese: ja

In order to show the correct language of the widget based on the active language on the website, you just need to use the language code inside the lang variable in the code snippet.

Initialize Push Notifications

To use the Push Notifications feature through Gameball with Firebase or Huawei services, ensure the appropriate dependencies are added. Then, initialize the device token by calling the following method—either immediately after the init method or before registering the customer.

Firebase Push Service

gameballApp.initializeFirebase();
// Using the instantiated instance of GameballApp
gameballApp.initializeFirebase()

Huawei Push Service

String appId = "123456789";
gameballApp.initializeHuawei(appId);
val appId = "123456789"
gameballApp.initializeHuawei(appId)
PreviousAndroidNextInitialize Gameball Customer Profile

Last updated 27 days ago

For the latest Firebase SDK (BOM, Cloud Messaging, Deep Links, and Google Services) versions check their .

Follow tutorial to learn more on how to register your Android application to Firebase.

Learn how you can configure the languages on your Gameball account through this .

release notes
this
article