TOP > Core API > RakutenReward
Table of Contents
RakutenReward class provides main settings and main functions of Reward SDK.
Property Name | Description |
---|---|
appCode | Reward SDK Application Key |
lastFailed | The last failed API call |
status | Reward SDK status |
tokenType | Switch ID solution |
user | User Data |
version | Reward SDK version |
JAVA
In JAVA, to access the property value please use the get
method.
Example
RakutenReward.INSTANCE.getAppCode();
Method Name | Description |
---|---|
addRakutenRewardListener | Add Event Listener |
clearAccessToken | Clear Access Token |
forceClaimClose | Close claim UI forcibly |
getMissions | Get the mission list |
getMissionsLite | Get the mission lite list |
getMissionDetails | Get the mission details |
getPointHistory | Get user's last 3 months point history |
getUnclaimedItems | Get the list of unclaimed items |
init | Initialize Reward SDK |
logAction | Post a mission action |
memberInfo | Get the latest member info |
openHelpPage | Open Rakuten Reward Help Page |
openPrivacyPage | Open Rakuten Reward Privacy Policy Page |
openTCPage | Open Rakuten Reward T&C Page |
removeRakutenRewardListener | Remove Event Listener |
requestForConsent | Request for consent if user have not provide consent yet |
setRa | Set Ra cookie |
setRaeToken | Set RAE Token |
setRidToken | Set RID Token |
setRp | Set Rp cookie |
setRz | Set Rz cookie |
startSession | Start SDK session |
showConsentBanner | Show User consent notification banner |
RakutenRewardListener is Rakuten Reward SDK basic function status change listener.
Name | Description |
---|---|
fun onUnclaimedAchievement(achievement: MissionAchievementData) | When the user achieved the mission |
fun onUserUpdated(user: RakutenRewardUser) | When the user data is updated |
fun onSDKStatusChanged(status: RakutenRewardSDKStatus) | When the SDK status changed |
fun onSDKClaimClosed(missionAchievementData: MissionAchievementData, status: RakutenRewardClaimStatus) | When the claim UI closed |
fun onSDKConsentClosed() | When consent dialog is closed (Since v4.0.0) |
fun onSDKConsentPresented() | When consent dialog is shown (Since v5.4.0) |
fun onSDKClaimPresented(missionAchievementData: MissionAchievementData) | When the claim UI is shown (Since v5.4.0) |
RakutenReward.addRakutenRewardListener(this)
If this method is used in Activity or Fragment class, please call the remove API whenever Activity class is destroyed to prevent memory leak.
RakutenReward.removeRakutenRewardListener(this)
Please refer here for more information.
The following API return a list of MissionData
object.
Kotlin
RakutenReward.getMissions({ missions ->
// get missions success
}) {
// get missions failed
}
JAVA
RakutenReward.getMissionsJava(new GetMissionsCallback() {
@Override
public void success(@NonNull List<MissionData> list) {
}
@Override
public void fail(@NonNull RakutenRewardAPIError rakutenRewardAPIError) {
}
});
val result : RewardApiResult<List<MissionData>> = RakutenRewardCoroutine.getMissions()
The following API return a list of MissionLiteData
object.
Recommend to use this API if you are not displaying mission progress
Kotlin
RakutenReward.getMissionsLite({ missions ->
// get missions success
}) {
// get missions failed
}
JAVA
RakutenReward.getMissionsLiteJava(new GetMissionsLiteCallback() {
@Override
public void success(@NonNull List<MissionLiteData> list) {
}
@Override
public void fail(@NonNull RakutenRewardAPIError rakutenRewardAPIError) {
}
});
val result : RewardApiResult<List<MissionLiteData>> = RakutenRewardCoroutine.getMissionsLite()
The following API return the MissionData
object of the provided action code.
Kotlin
RakutenReward.getMissionDetails("<actionCode>", { mission ->
// get mission success
}) {
// get mission failed
}
JAVA
RakutenReward.getMissionDetailsJava("<actionCode>", new GetMissionDetailsCallback() {
@Override
public void success(@NonNull MissionData missionData) {
}
@Override
public void fail(@NonNull RakutenRewardAPIError rakutenRewardAPIError) {
}
});
val result : RewardApiResult<MissionData> = RakutenRewardCoroutine.getMissionDetails()
The following API return a RakutenRewardPointHistory
object.
Kotlin
RakutenReward.getPointHistory({ pointHistory ->
// success
}, {
// error
})
JAVA
RakutenReward.getPointHistoryJava(new PointHistoryCallback() {
@Override
public void success(@NonNull RakutenRewardPointHistory rakutenRewardPointHistory) {
}
@Override
public void fail(@NonNull RakutenRewardAPIError rakutenRewardAPIError) {
}
});
val result : RewardApiResult<RakutenRewardPointHistory> = RakutenRewardCoroutine.getPointHistory()
The following API return a list of MissionAchievementData
objects.
Kotlin
RakutenReward.getUnclaimedItems({ unclaimed ->
// success
}) {
// error
}
JAVA
RakutenReward.getUnclaimedItemsJava(new UnclaimedItemCallback() {
@Override
public void success(@NonNull List<MissionAchievementData> list) {
}
@Override
public void failed(@NonNull RakutenRewardAPIError rakutenRewardAPIError) {
}
});
val result : RewardApiResult<List<MissionAchievementData>> = RakutenRewardCoroutine.getUnclaimedItems()
Initialize SDK
Since 3.3.0, these API are deprecated due to manual initialization is no longer needed. Refer here for more information.
RakutenReward.init("<appCode>")
Parameter name | Description |
---|---|
AppCode | Application Key (This is from Rakuten Reward Developer Portal) |
For RID, RAE login options
You can provide access token in the init API.
RakutenReward.init("<appCode>", "<token>")
The following API post a mission action.
Kotlin
RakutenReward.logAction("actionCode", {
// post action success
}) {
// post action failed
}
JAVA
RakutenReward.logActionJava("actionCode", new LogActionCallback() {
@Override
public void success() {
}
@Override
public void fail(@NonNull RakutenRewardAPIError rakutenRewardAPIError) {
}
});
val result : RewardApiResult<Unit> = RakutenRewardCoroutine.logAction("actionCode")
When a mission achievement is already reached its cap, this logAction
API will return MISSION_REACHED_CAP
error code.
The following API return a RakutenRewardUser
object
Kotlin
RakutenReward.memberInfo({ user ->
// success
}) {
// error
}
JAVA
RakutenReward.memberInfoJava(new MemberInfoCallback() {
@Override
public void success(@NonNull RakutenRewardUser rakutenRewardUser) {
}
@Override
public void fail(@NonNull RakutenRewardAPIError rakutenRewardAPIError) {
}
});
val result : RewardApiResult<RakutenRewardUser> = RakutenRewardCoroutine.memberInfo()
SDK provide page open with API
Help Page
RakutenReward.openHelpPage()
Terms and Condition Page
RakutenReward.openTCPage()
Privacy Policy
RakutenReward.openPrivacyPage()
These API is mainly for Rakuten App and use cookies which app keeps.
If you use default login option (RAKUTEN_AUTH
), cookie is handled by Reward SDK.
If you use other options, you can override cookie using these API.
Set Rz Cookie
RakutenReward.setRz("cookie")
Set Rp Cookie
RakutenReward.setRp("cookie")
RakutenReward.setRa("cookie")
Request for consent if the user have not provide consent.
If user have not provide consent, Consent Dialog will be shown to ask for user's consent.
Else the callback will be triggered immediately with CONSENT_PROVIDED
status. Refer here for more information.
The callback return RakutenRewardConsentStatus
.
Kotlin
RakutenReward.requestForConsent { status ->
// check consent status
}
JAVA
RakutenReward.requestForConsentJava(rakutenRewardConsentStatus -> {
// check consent status
});
Show notification banner if user have not provide consent.
If user have not provide consent, notification banner will be shown. When tap on the banner, consent dialog will be shown.
Else the callback will be triggered immediately with CONSENT_PROVIDED
status. Refer here for more information.
The callback return RakutenRewardConsentStatus
.
Kotlin
RakutenReward.showConsentBanner {
// check consent status
}
JAVA
RakutenReward.showConsentBannerJava(rakutenRewardConsentStatus -> {
// check consent status
});
Manually start SDK session. When SDK is ONLINE, onSDKStatusChanged
will be triggered.
RakutenReward.startSession()
LANGUAGE :