TOP > FAQ
Table of Contents
- General
- Reward SDK is written in JAVA or Kotlin? My applcation is written in JAVA fully, is there any problem using the Reward SDK?
- Can we access the staging environment for development / testing?
- Does Reward SDK collect end user's Advertising ID (ADID)?
- How to opt out collecting end user's Advertising ID (ADID)?
- Build Error - unable to find valid certification path to requested target
- I've integrated Reward SDK version 6.1.0, and the app crash when I enable obfuscation
- Login Related
- Implementation Related
- The API always return SDKNOTACTIVE error. What could be the cause?
- I have a daily launch app mission. How should I implement it?
- How can I implement the custom notification UI?
- How do I claim mission after a mission is achieved?
- How do I implement onSDKStatusChanged or onUnclaimedAchievement?
- Is it possible to detect SDK Portal closed event?
- After I set token using RakutenReward.setRaeToken / RakutenReward.setRIdToken but SDK status is still offline.
- BOM
Reward SDK is written in JAVA or Kotlin? My applcation is written in JAVA fully, is there any problem using the Reward SDK?
Answer
Reward SDK is written in Kotlin fully.Reward SDK is supported for JAVA as well, but there might be some difference in calling the API.
Please refer here for the full description.
Answer
No, currently we do not provide staging environment for developers. Please use development mode or test account for development / testing.Answer
Yes, Reward SDK do collect user's Advertising ID (ADID).Reward SDK uses the ADID for Advertisement Optimization.
Answer
Reward SDK uses Google Play library Ads Identifier to collect user ADID. In order to stop collecting user ADID add the following changes:Add the following in app/build.gradle file to remove Ads Identifier library.
implementation ('com.rakuten.android:rewardsdknative-ui:x.x.x') {
exclude group: 'com.google.android.gms', module: 'play-services-ads-identifier'
}
Add the following in AndroidManifest file to disable ADID permission.
<uses-permission
android:name="com.google.android.gms.permission.AD_ID"
tools:node="remove" />
To verify Reward SDK does not collect user ADID anymore, check for the following log:
I got build error on importing Reward SDK dependency. How to resolve this error?
Answer
There are 2 approaches to fix this issue.
1. Update Gradle JDK
Update the Gradle JDK in Android Studio.
First open Project Structure and click on Gradle Settings.
For the JDK, do not use Android Studio default JDK. If there is other JDK please choose that JDK. Else download a new JDK.
After download the new JDK, choose that JDK version to click OK.
Gradle sync the project again.
2. Import CA Certificate
First download the CA certificate from raw.githubusercontent.com
Open the link https://raw.githubusercontent.com/rakuten-ads/Rakuten-Reward-Native-Android/master/maven/com/rakuten/android/rewardsdknative-ui/3.4.2/rewardsdknative-ui-3.4.2.pom in Google Chrome.
Then click on the lock icon to download the CA certificate.
Next is to import the CA certificate to JAVA trust store.
First check where is the Android Studio Gradle JDK location.
Then run the following script where JDK-location
is the jdk path above.
cd <JDK-location>/Contents/Home
Then import the cert to JAVA trust store where cert-path
is the path of the downloaded CA certificate.
./bin/keytool -importcert -keystore lib/security/cacerts -storepass changeit -file <cert-path> -alias "github_cert"
After accepting the cert to the trust store, restart Android Studio and Gradle sync again.
If both the approach above doesn't help, please contact the developer team.
The following SDK versions are affected with the exception above:
- 6.1.0
- 6.2.0
- 7.0.0
This issue has been fixed in SDK version 7.0.1.
Answer
If you cannot upgrade the SDK version, please add the following to your proguard-rules.pro
file.
-keep class com.rakuten.gap.ads.mission_remote.** { *; }
Answer
The RakutenAuth login option is for third-party. For example, apps outside Rakuten which do not use Rakuten login SDK (RID or RAE). Therefore they can use the RakutenAuth login option.If your app is using Rakuten login SDK already, then you don't need to use this login option.
Answer
If you are using Reward SDK version 3.1.1 and above, then yes you need to call the logout API regardless of which login options to properly clear the token and data.RakutenAuth.logout(object : LogoutResultCallback {
override fun logoutSuccess() {
//logout completed
}
override fun logoutFailed(e: RakutenRewardAPIError) {
//logout failed
}
})
Answer
Yes, you can call the API in a Fragment class by providing the Fragment instance andonActivityResult
will be triggered in the Fragment class.
Sample implementation
class TestLoginFragment : Fragment() {
companion object {
private const val LOGIN_REQ_CODE = 533
}
private fun login() {
// provide the Fragment instance instead of requireActivity()
RakutenAuth.openLoginPage(this, LOGIN_REQ_CODE)
// if the following is called, then onActivityResult will be triggered in the Activity class instead
// RakutenAuth.openLoginPage(requireActivity(), LOGIN_REQ_CODE)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == LOGIN_REQ_CODE) {
if (resultCode == RESULT_OK) {
RakutenAuth.handleActivityResult(data, object : LoginResultCallback {
override fun loginSuccess() {
// login success
}
override fun loginFailed(e: RakutenRewardAPIError) {
Toast.makeText(requireContext(), "Login Failed", Toast.LENGTH_SHORT).show()
}
})
} else {
Toast.makeText(requireContext(), "Login Cancelled", Toast.LENGTH_SHORT).show()
}
}
}
}
Answer
This error means Reward SDK is not yet started and haven't sync up data.
First check is the init API called in the Application class and check is the provided App Key correct.
RakutenReward.init(<AppKey>)
*From version 3.3.0 onward, manual initialization is no longer needed.
Set your
App Key
in your application's AndroidManifest.xml as follow:<application> <!-- Reward SDK Application Key --> <meta-data android:name="com.rakuten.gap.ads.mission_core.appKey" android:value="{Application Key}"/> </application>
Then check is the Activity class which call the API had use one of the options here to start the SDK.
If both the above are setup correctly, wait for the SDK status changed to ONLINE
before calling the API. Status changed will be triggered in the method below.
override fun onSDKStatusChanged(status: RakutenRewardSDKStatus) {
if (status == RakutenRewardSDKStatus.ONLINE) {
// SDK is active now, call the API here
}
}
Answer
To log the mission's action code everytime user launch the app, you should wait the SDK status changed to ONLINE
first. This is due to Reward SDK require some time to sync up data.
The status changed will be triggered in the method below.
override fun onSDKStatusChanged(status: RakutenRewardSDKStatus) {
if (status == RakutenRewardSDKStatus.ONLINE) {
RakutenReward.logAction(<ActionCode>, {
// log action success
}) {
// log action failed
}
}
}
Answer
For example, Mission A need 3 actions logged to be achieved.RakutenReward.logAction(<ActionCode>, {
// log action success
}) {
// log action failed
}
After the above logAction
API is called 3 times successfully, Mission A is achieved and onUnclaimedAchievement
method in RakutenRewardListener
will be triggered.
Sample implementation for showing custom UI
override fun onUnclaimedAchievement(achievement: MissionAchievementData) {
if (achievement.custom // check is notification type CUSTOM
&& RakutenRewardConfig.isUiEnabled() // check if user enable the UI setting
) {
// Show custom UI in MAIN thread
}
}
Answer
Claim API is available in theMissionAchievementData
object.
achievement.claim({
// claim success
}) {
// claim failed
}
There are 2 ways to get MissionAchievementData
object.
First is when user achieved a CUSTOM notification type mission, onUnclaimedAchievement
will be triggered.
override fun onUnclaimedAchievement(achievement: MissionAchievementData) {
if (achievement.custom // check is notification type CUSTOM
&& RakutenRewardConfig.isUiEnabled() // check if user enable the UI setting
) {
// Show custom UI in MAIN thread and call the following to claim mission
achievement.claim({
// claim success
}) {
// claim failed
}
}
}
Second is by calling get unclaim items API.
RakutenReward.getUnclaimedItems({ unclaimList ->
unclaimList[0].claim({
// claim success
}) {
// claim failed
}
}) {
// get unclaim items failed
}
Answer
onSDKStatusChanged, onUnclaimAchievement are methods in RakutenRewardListener. Create a new object of RakutenRewardListener and provide your implementation for each methods.val listener = object : RakutenRewardListener {
override fun onUnclaimedAchievement(achievement: MissionAchievementData) {
// user achieved a mission. This is mainly used for CUSTOM notification type.
}
override fun onUserUpdated(user: RakutenRewardUser) {
// user data is updated
}
override fun onSDKStatusChanged(status: RakutenRewardSDKStatus) {
// Reward SDK status changed
}
override fun onSDKClaimClosed(
missionAchievementData: MissionAchievementData,
status: RakutenRewardClaimStatus
) {
// claim view is closed
}
}
Then call the following APIs to add or remove the listener object. Remove listener API is required to prevent memory leak.
override fun onResume() {
RakutenReward.addRakutenRewardListener(listener)
super.onResume()
}
override fun onPause() {
super.onPause()
RakutenReward.removeRakutenRewardListener(listener)
}
❕ If you are using
RakutenRewardBaseActivity
to start the SDK, the above are not needed asRakutenRewardBaseActivity
class already handled it. You can simply override the method which you needed and provide you own implementation
Answer
Yes, it is possible to detect SDK portal closed event. Provide a unique request code toopenSDKPortal
API and onActivityResult
will be triggered when SDK portal is closed.
Sample implementation
class SampleActivity : RakutenRewardBaseActivity() {
companion object {
private const val UNIQUE_REQ_CODE = 478
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
RakutenReward.openSDKPortal(UNIQUE_REQ_CODE)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == UNIQUE_REQ_CODE) {
// handle SDK portal closed event
} else {
super.onActivityResult(requestCode, resultCode, data)
}
}
}
❕
RakutenReward.openSDKPortal()
API can be call inFragment
class as well, howeveronActivityResult
will be triggered in Fragment class's parent activity instead
After I set token using RakutenReward.setRaeToken
/ RakutenReward.setRIdToken
but SDK status is still offline.
Answer
After setting the token, need to manually trigger to start SDK session by calling the following API.RakutenReward.startSession()
Sample implementation
class SampleActivity : RakutenRewardBaseActivity() {
....
private fun setToken() {
RakutenReward.setRaeToken("token")
// this API is available since v3.4.2
RakutenReward.startSession()
}
}
Answer
No. You can still choose to add each dependency version manually. However, we recommend using the BOM as it will make it easier to use all of the latest stable versions at the same time.Answer
You can specify your desire library version to override the version designated in the BOM.Answer
No. To actually add and use Reward Native libraries in your app, you must declare each library as a separate dependency line your gradle file.Using the BOM ensures that the versions of any Reward Native libraries in your app are compatible, but the BOM doesn't actually add those libraries to your app.
LANGUAGE :