TOP > Request User Consent
Table of Contents
- Overview
- Changes to existing API
- Request User Consent API
- Show consent notification banner
- Sample Use Case
- How to Test
Since version 5.0.0, Reward SDK integrated request user consent feature.
In order to use Reward SDK's features, users have to provide their consent for Reward term of use and privacy policy first.
Below will go through how to request for user consent and the changes to existing API.
New Reward SDK status is introduced as mentioned here.
userNotConsent
status will be returned in RakutenReward.shared.didUpdateStatus: ((RakutenRewardStatus) -> Void)?
when the user have not provide consent yet.
This status will be updated when startSession API is called and if user has not agree to Reward SDK's terms and condition.
New callback is added to RakutenReward as mentioned here.
RakutenReward.shared.didPresentConsentUI
will be triggered whenever a consent dialog is presented.
RakutenReward.shared.didDismissConsentUI
will be triggered whenever a consent dialog is dismissed.
New API is introduced to request for user consent.
RakutenReward.shared.requestForConsent { status in
// Check consent status
}
If user have not provide consent yet, a consent dialog will be shown.
Depends on user action, will the following consent status will be return in the callback.
RakutenRewardConsentStatus | Description |
---|---|
consentProvided | User already provide consent |
consentNotProvided | User have not provide consent |
consentFailed | There is some error with API request |
consentProvidedRestartSessionFailed | User provided consent but failed to restart SDK session |
If user already provided consent, the consent dialog will not be shown and the callback will be triggered with consentProvided
status.
New API is introduced to show notification banner when user haven't provide consent.
RakutenReward.shared.showConsentBanner { status in
// Check consent status
}
The banner above will only be shown when user haven't provide consent. When tap on the banner, consent dialog will be shown to request user's consent.
If user already provided consent, the banner will not be shown and the callback will be triggered with consentProvided
status.
Reward SDK will not display consent dialog on behalf of client app unless RakutenReward.shared.requestForConsent()
API is called.
So client app developers can decide which screen to display the consent dialog.
RakutenReward.shared.openPortal()
API will handle the case where user haven't provide consent.
After user provided the consent will proceed to open SDK portal page.
If user don't provide consent, SDK portal page will not be shown.
Sample code on when to request user consent
// Callback when SDK status is updated
RakutenReward.shared.didUpdateStatus = { sdkStatus in
// If SDK status is changed to user not consent
if sdkStatus == .userNotConsent {
// Request for user consent, SDK will present the consent UI
RakutenReward.shared.requestForConsent { consentStatus in
// Handle next action depending on consentStatus
}
}
}
Most of the SDK APIs will fail if SDK status is not Online. This includes the situation where SDK Status is .userNotConsent. One of the way to handle is with the code below
func exampleLogAction() {
// Check if SDK is online...
// Check if SDK status is user not consent
RakutenReward.shared.requestForConsent { consentStatus in
// Call the API if consent is provided
}
}
Even if user already provided consent, it is still safe to call RakutenReward.requestForConsent()
API as consent dialog will not be shown and consentProvided
status will be return in the callback.
Currently this feature is not enabled yet. To test the feature in development phase, please create a ticket here and provide a list of test account's Easy ID for us to whitelist these accounts.
LANGUAGE :