Initialize Referd User Profile
Show your players's profile including all details and progress on your Android app.
Last updated
Show your players's profile including all details and progress on your Android app.
Last updated
Showing the Referd widget on your mobile application is slightly different than showing it on the website. You have two options; first, if you want to design your customer interface, you will use our set of REST APIs. The other option as this section elaborates, is through using our android SDK.
Using the SDK, you can open the Referd user profile from a button in your app, programmatically when someone does something, or from a persistent button that sits over your app’s UI.
When you trigger the Referd user profile, your player is presented with a home screen. This is configurable inside Referd to change how it looks and what’s presented.
From there, your user can check his progress across different Referd programs as per your configurations.
To show the Referd player profile that contains the user details, user challenges, and the leaderboard use showProfile() SDK method.
Parameter
Type
Required
Description
Activity
Activity
Yes
Current activity instance holding the GameballApp which will be used in showing the User's profile.
PlayerUniqueId
String
Yes
Unique identifier for the user in your database.
Could be database ID, random string, email or anything that uniquely identifies the user.
openDetail
String
No
Specify if you want the widget to open on a specific view. Possible values are details_referral
hideNavigation
Boolean
No
Set to true to stop widget navigation otherwise leave as null.
Use showProfile as a parameter to collect the activity or the fragment you are going to show the profile in. Just create a button and call this method in the onClick() method of this button.
Change Profile Widget language
changeLanguage(String language)
Use changeLaguage
SDK method to change the widget language.The language provided should be as per configured languages in your account. If not provided the Referd profile widget will be shown with your account default language
Example: "en"
, "fr"
.
You should register your users with Referd. This can be done using registerPlayer
method which can be used to create or update the player details at Referd. Ideally, it is called when your login or register network call is successful.
Parameter
Type
Required
Description
PlayerUniqueId
string
Yes
Unique identifier for the user in your database.
Could be database ID, random string, email or anything that uniquely identifies the user.
PlayerAttributes
object
No
PlayerAttributes is a builder class with set of properties that you want to set for the user.
Activity
Activity
Yes
Current activity instance holding the GameballApp which will be used in detecting the referal code from the dynamic link.
Intent
Intent
Yes
An intent instance that will be used in combination with the Activity to detect the referal code from the dynamic link.
CallBack
function
No
Callback is used for providing the developer with the response status and payload.
Everytime the SDK is initialized with a new playerUniqueId , the user profile is created or updated at Referd side. You may consider enriching your Referd's user profile with attributes that are not avialable to the UI by using server side Create\Update User API
Choose an Unchangeable Player Unique ID
Referd user profile gets created using the playerUniqueId
. It is highly recommended to have the unique ID as an identifier that would NEVER be changed. If this unique ID changes for a given player, you risk losing all original data for that user on Referd. Accordingly, it is NOT recommended to use email address or mobile number as the unique ID as both can be changed by the user at anytime.
PlayerAttributes
Object
PlayerAttributes is a builder class that helps in creation of the PlayerAttributes with the common attributes mentioned below, all of these attributes are optional to use.
withDisplayName
displayName
string
withFirstName
firstName
string
withLastName
lastName
string
withEmail
string
withGender
gender
string
withMobileNumber
mobileNumber
string
withDateOfBirth
dateOfBirth
string
withJoinDate
joinDate
string
withCustomAttribute
(key, value)
(string, string)
The previous example will return an object of PlayerAttributes with DisplayName “Jack”
Using the previously created GameballApp instance or by creating a new one, call the RegisterPlayer() method as shown below