Gameball Developers Guide
v3.0
Ask or search…
⌃K

Initialize GameballApp SDK

Create a GameballApp instance.

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.
Java
Kotlin
GameballApp gameballApp = GameballApp.getInstance(getApplicationContext());
val gameballApp = GameballApp.getInstance(applicationContext)

Initialize GameballApp Instance

To initialize GameballApp instance in your application class, use the init method which takes the following parameters:
Parameter
Type
Required
Description
APIKey
string
Yes
Client API key
lang
string
No
Your platform language preference to view Gameball Widget with.
Note: 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".
platform
string
No
Your platform name
shop
string
No
Your shop name.
Java
Kotlin
// 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}}")

Initialize Firebase Push Notifications

To be able to use Firebase Push Notifications feature through Gameball you'd need to first initialize firebase device token by calling the following method right after the init method or before the registration of the player.
Java
Kotlin
// Using the instantiated instance of GameballApp
gameballApp.initializeFirebase();
// Using the instantiated instance of GameballApp
gameballApp.initializeFirebase()