Android SDK Available Methods

You can find here the library that supports all the methods listed on Android SDKs.

Change language

chnageLangueg(String language)

It simply takes a 2 character string that represents the languge you want gameball widget to open with


registerPlayer is used to create the player Gameball. Ideally it called when your login/registration API call is successful.

The registerPlayer method can take 4 different parameters :

  • String PlayerUniqueId (required)

  • Int playerTypeID (optional)

  • PlayerAttributes playerAttributes (optional)

    • PlayerAttributes is a builder class

    • example: new PlayerAttributes.Builder().withDisplayName(“Jack”).build();

    • The above example will return an object of PlayerAttributes with displayName “Jack”

  • Callback<PlayerRegisterResponse> callback (required)

editPlayerAttributes(PlayerAttributes playerAttributes, Callback callback)

editPlayerAttributes is used to change or add information about the player such as display name, gender, joingin date, ect..

  • It takes PlayerAttributes object which is a builder class as mentioned in registerPlayer method description

  • It takes a callback to provide you with the response

Notes :

  • playerAttributes.dateOfBirth format -> “yyyy-mm-dd”

  • playerAttributes.joinDate format -> “yyyy-mm-dd”

  • playerAttributes.gender format -> “M” for male / “F” for female

addAction(Action action, Callback callback)

You can send player events to Gameball through event API or through the SDK methods below.

addAction is used to submit an action done by the user such as buying something.

Actions are represented as events and to add an event you should use the addEvent method on the Action object you have created.

addEvent(String eventName, HashMap metaData)

To add a user action check the example below:

Action action = new Action();
HashMap<String, Object> metaDeta = new HashMap<String, Object>()
metaData.put(<meta_data_string_value>, 500)

action.addEvent(<event_name>, metadata)

GameBallApp.getInstance(<ApplicationContext>).addAction(action, new Callback)

showProfile(AppCompatActivity activity/ Fragment fragment)

showProfile is used to show the Profile of the user that contains the User Details, User Challenges and Leaderboard for example. It should be called upon a click of a certain button of your choice according to your design.

  • It takes as a parameter the either the activity of the fragment you are calling the method from, it will show an activity of Gameball interface.

addReferral(Activity activity, Intent intetn)

addReferral is used to check if the new registered user is referred from another player or not, using google’s solution Dynamic links. It should be called in the onSucess of registerPlayer method.

Add the firebase dynamic links dependency in your project

  • implementation ‘′

    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>

In your manifest file add an intent filter in the activity where you are going to call addReferral in. You can ignore the handle deeplinking part if you don’t want to use it.


Last updated