Referral System
Configure
Please, add the next parameters to your AndroidManifest.xml.
You should ask your manager for the values of these parameters
<meta-data
android:name="com.platform101xp.app_link"
android:value="@string/app_link" />
<meta-data
android:name="com.platform101xp.link_domain"
android:value="@string/dynamic_link_domain" />
<meta-data
android:name="com.platform101xp.link_app_store"
android:value="@string/app_store_link" />
<meta-data
android:name="com.platform101xp.app_store_id"
android:value="@string/app_store_id" />
app_link – app’s homepage
dynamic_link_domain - dynamic link domain
app_store_link - link to the application in the AppStore
app_store_id - application ID in the AppStore
Also, you need to add the following intent-filter for the main activity of your application to the AndroidManifest.xml manifest file.
For the value yoursite.example.com ask your manager, please:
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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="yoursite.example.com"
android:scheme="http" />
<data
android:host="yoursite.example.com"
android:scheme="https" />
</intent-filter>
</activity>
Also, you can change an invite message:
<meta-data android:name="com.platform101xp.invite_message"
android:value="@string/app_invite_message" />
Usage
Referral invites
To send a referral invitation to another user, you need to call sendInviteLink(String event) method:
// Java
Platform101XP.sendInviteLink("event_referrer_invite");
// Kotlin
Platform101XP.sendInviteLink("event_referrer_invite")
Where the event is the value of the event you want to receive and process further with the Platform101XPListener methods.
Rewarding users
To reward users, you need to implement two Platform101XPListener methods:
// Java
void onRewardedInviteLinkSender(String event) {
}
// Kotlin
override fun onRewardedInviteLinkSender(event: String?) {
}
That will be called after the user fulfills the conditions for the reward
event - value from sendInviteLink() method
// Java
boolean onRewardedInviteLinkRecipient(String referrer, String event) {
}
// Kotlin
override fun onRewardedInviteLinkRecipient(referrer: String?, event: String?): Boolean {
}
That will be called after getting an invite by recipient. This method should return true if the user has fulfilled the conditions for the reward (for example, reached level 10).
referrer - the identifier of the user who invited the current user.
event - value from sendInviteLink() method