Android SDK Available Methods

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

registerPlayer

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)

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 you created.

<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data
android:host="example.com"
android:scheme="https"/>
</intent-filter>

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 ‘com.google.firebase:firebase-dynamic-links:17.0.0′

<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data
android:host="example.com"
android:scheme="https"/>
</intent-filter>

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.

Reference: https://firebase.google.com/docs/dynamic-links/android/receive