Skip to content

Latest commit

 

History

History
484 lines (379 loc) · 16.9 KB

RakutenReward.md

File metadata and controls

484 lines (379 loc) · 16.9 KB

TOP > Core API > RakutenReward

Table of Contents


RakutenReward

RakutenReward class provides main settings and main functions of Reward SDK.

Properties

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();

Public Methods

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

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)

To add the listener
support version

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.

To remove the listener
support version

RakutenReward.removeRakutenRewardListener(this)

Please refer here for more information.


Mission List

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) {

    }
});

Coroutine
support version

val result : RewardApiResult<List<MissionData>> = RakutenRewardCoroutine.getMissions()

Mission Lite List

support version
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) {

    }
});

Coroutine
support version

val result : RewardApiResult<List<MissionLiteData>> = RakutenRewardCoroutine.getMissionsLite()

Mission Details

support version
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) {

    }
});

Coroutine
support version

val result : RewardApiResult<MissionData> = RakutenRewardCoroutine.getMissionDetails()

Point History

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) {

    }
});

Coroutine
support version

val result : RewardApiResult<RakutenRewardPointHistory> = RakutenRewardCoroutine.getPointHistory()

Unclaimed Items

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) {

    }
});

Coroutine
support version

val result : RewardApiResult<List<MissionAchievementData>> = RakutenRewardCoroutine.getUnclaimedItems()

Init API

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>")

Post Mission Action

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) {

    }
});

Coroutine
support version

val result : RewardApiResult<Unit> = RakutenRewardCoroutine.logAction("actionCode")

Mission Achievement Reached Cap

support version
When a mission achievement is already reached its cap, this logAction API will return MISSION_REACHED_CAP error code.


Member Information

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) {

    }
});

Coroutine
support version

val result : RewardApiResult<RakutenRewardUser> = RakutenRewardCoroutine.memberInfo()

Open Reward Web Page

SDK provide page open with API

Help Page

RakutenReward.openHelpPage()

Terms and Condition Page

RakutenReward.openTCPage()

Privacy Policy

RakutenReward.openPrivacyPage()

Set Rakuten Cookie

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")

Set Ra Cookie
support version

RakutenReward.setRa("cookie")

Request for Consent

support version
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
});

User Consent Notification Banner

support version
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
});

Start SDK Session

support version
Manually start SDK session. When SDK is ONLINE, onSDKStatusChanged will be triggered.

RakutenReward.startSession()

LANGUAGE :

ja