‹ Reviews&Ratings Doc Home

Reviews & Ratings Integration Guide

For the Javascript version of cocos2d-x v3.x - (all other versions)

SDK Version


Open a terminal and use the following command to install the SDKBOX Ratings & Reviews plugin. Make sure you setup the SDKBOX installer correctly.

$ sdkbox import review

Important Notice

Please make sure the following settings in your project to make the plugin work well.

Disable App Transport Security

Adding the following entry to the info.plist file:


It should look like this:

Disable Bitcode support

You have to turn off Bitcode support. If you don't, cocos2d-x will fail to build.

Set your game requires full screen

If your game doesn't support all screen orientations, you will need to check Requires full screen in Xcode. If you do not, your app will fail Apple's submission process.

Whitelist canOpenURL function

This setting depends on what plugins are in your project. You may need to add the required entry to the info.plist, under LSApplicationQueriesSchemes.

Extra steps for Android

Modify AppActivity.java

Plugin >=

  1. Find the AppActivity.java
find . -name "AppActivity.java"
  1. Replace extends Cocos2dxActivity with extends com.sdkbox.plugin.SDKBoxActivity

Example of the directory where the AppActivity.java file is located:

  - proj.android/src/org/cocos2dx/cpp/AppActivity.java
  - proj.android-studio/app/src/org/cocos2dx/cpp/AppActivity.java
  - proj.android/app/src/org/cocos2dx/cpp/AppActivity.java ( from cocos2d-x 3.17)

  - frameworks/runtime-src/proj.android/src/org/cocos2dx/lua/AppActivity.java
  - frameworks/runtime-src/proj.android-studio/app/src/org/cocos2dx/lua/AppActivity.java
  - frameworks/runtime-src/proj.android/app/src/org/cocos2dx/lua/AppActivity.java (from cocos2d-x 3.17)

  - frameworks/runtime-src/proj.android/src/org/cocos2dx/javascript/AppActivity.java
  - frameworks/runtime-src/proj.android/app/src/org/cocos2dx/javascript/AppActivity.java ( from cocos2d-x 3.17)

Plugin <

Note: When using Cocos2d-x from source, different versions have Cocos2dxActivity.java in a different location. One way to find the location is to look in proj.android/project.properties. Example: android.library.reference.1=../../cocos2d-x/cocos/platform/android/java

In this case, Cocos2dxActivity.java should be located at:

import android.content.Intent;
import com.sdkbox.plugin.SDKBox;
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          if(!SDKBox.onActivityResult(requestCode, resultCode, data)) {
            super.onActivityResult(requestCode, resultCode, data);
    protected void onStart() {
    protected void onStop() {
    protected void onResume() {
    protected void onPause() {
    public void onBackPressed() {
          if(!SDKBox.onBackPressed()) {

Proguard (release, optional)

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;

# cocos2d-x
-keep public class org.cocos2dx.** { *; }
-dontwarn org.cocos2dx.**
-keep public class com.chukong.** { *; }
-dontwarn com.chukong.**

# google play service
-keep public class com.google.android.gms.** { public *; }
-dontwarn com.google.android.gms.**

-keep class com.google.protobuf.** { *; }
-dontwarn com.google.protobuf.**

-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;

-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;

-keep public class com.sdkbox.** { *; }
-dontwarn com.sdkbox.**

Note: Proguard only works with Release builds (i.e cocos run -m release) debug builds do not invoke Proguard rules.

JSON Configuration

SDKBOX Installer will automatically inject a sample configuration to your res/sdkbox_config.json, that you have to modify it before you can use it for your own app

Here is an example of the configuration.

    "ios": {
            "AppID":"587767923",            //appid, valid on ios
            "DayLimit": 0,                  //days before rate prompt show
            "LaunchLimit": 3,               //launch times before rate prompt show
            "UserEventLimit": 0,            //user event times before rate prompt show, user event increase by invoke userDidSignificantEvent
            "DayForReminding": 1,           //days after user selected reminding later button
            "LaunchForReminding": 2,        //launch times after user selected reminding later button
            "tryPromptWhenInit": true       //try to display prompt when plugin initialization
    "android": {
            "DayLimit": 0,
            "LaunchLimit": 3,
            "UserEventLimit": 0,
            "DayForReminding": 1,
            "LaunchForReminding": 2,
            "tryPromptWhenInit": true


Register Javascript Functions

You need to register all the Review JS functions with cocos2d-x before using them.

To do this: * Modify ./frameworks/runtime-src/Classes/AppDelegate.cpp to include the following headers:

#include "PluginReviewJS.hpp"
#include "PluginReviewJSHelper.hpp"

Initialize Review

Initialize the plugin by calling init() where appropriate in your code. We recommend to do this in the app.js. Example:


Setting Review (optional)

You can set a custom string for the rate prompt, if you don't want to use the default string.

Note: if you set tryPromptWhenInit to true which is in sdkbox.config, you must call the following functions before init():

sdkbox.PluginReview.setTitle("custom title");
sdkbox.PluginReview.setMessage("custom message");
sdkbox.PluginReview.setCancelButtonTitle("custom cancel");
sdkbox.PluginReview.setRateButtonTitle("custom rate");
sdkbox.PluginReview.setRateLaterButtonTitle("custom rate later");

After initialization you can begin to use the Review functionality. Use show try to display rate prompt:


If you set UserEventLimit not 0 in sdkbox.config, you must call userDidSignificantEvent increase user event count: userDidSignificantEvent increase user event count


Catch Review events (optional)

This allows you to catch the Review events so that you can perform operations based upon responses. A simple example might look like this:

var plugin = sdkbox.PluginReview
  onDisplayAlert: function(data) {cc.log("didDisplayAlert")},
  onDeclineToRate: function(data) { cc.log("didDeclineToRate") },
  onRate: function(data) { cc.log("didToRate") },
  onRemindLater: function(data) { cc.log("didToRemindLater") }

Custom String

if you want to use custom string when prompt. there have two ways:

    "ios": {
            "promptTitle":"cutom tile",
            "promptMessage":"this is custom message",

this way will disable local language, if your app needn't localization, can use this way.

Amazon Market

if your app is availavle in amazon market, please configure like follow:

    "android": {


            "market": "amazon"

API Reference





initialize the plugin instance.


Set listener to listen for adcolony events


Tells 'SDKBox review plugin' to try and show the prompt (a rating alert). if you call show with false or null params, the prompt will be showed if there is connection available, the user hasn't declined to rate or hasn't rated current version. if the item tryPromptWhenInit in sdkbox.config is false, you can call this try to show prompt if you call show with true params the prompt will be showed without checks (the prompt is always displayed). The case where you should call this is if your app has an explicit "Rate this app" command somewhere. This is similar to rateApp, but instead of jumping to the review directly, an intermediary prompt is displayed. another case is for debug


goto rating page directly




trigger when alert prompt show


trigger when user refuse to rate


trigger when user want to rate


trigger when user want to remind later

Manual Integration

If the SDKBOX Installer fails to complete successfully, it is possible to integrate SDKBOX manually. If the installer complete successfully, please do not complete anymore of this document. It is not necessary.

These steps are listed last in this document on purpose as they are seldom needed. If you find yourself using these steps, please, after completing, double back and re-read the steps above for other integration items.

Manual Integration For iOS

Drag and drop the following frameworks or folder from the plugins/ios folder of the Review bundle into your Xcode project, check Copy items if needed when adding frameworks:




Copy all source and header files from plugin/jsbindings/ to your projects Classes folder.

NOTE: plugin/jsbindings/jsb2 for creator 1.7.

Add these same files, that you just copied, to Xcode by either dragging and dropping them into Xcode or by using File -> Add files to....

Manual Integration For Android

SDKBOX supports three different kinds of Android projects command-line, eclipse and Android Studio.

Copy Files

Copy the following jar files from plugin/android/libs folder of this bundle into your project's /libs folder.



Copy the plugin_review_res_project directory from plugin/android to your <project_root> directory. Make your Android project reference the plugin_review_res_project project.

Copy jni libs

Copy and overwrite all the folders from plugin/android/jni to your <project_root>/jni/ directory.

Edit AndroidManifest.xml

Include the following permissions above the application tag:

<uses-permission android:name="android.permission.INTERNET"/>

Edit Android.mk

Edit <project_root>/jni/Android.mk to:

Add additional requirements to LOCAL_STATIC_LIBRARIES:


Add a call to:

$(call import-add-path,$(LOCAL_PATH))

before any import-module statements.

Add additional import-module statements at the end:

$(call import-module, ./sdkbox)
$(call import-module, ./pluginreview)

This means that your ordering should look similar to this:

$(call import-add-path,$(LOCAL_PATH))
$(call import-module, ./sdkbox)
$(call import-module, ./pluginreview)

Note: It is important to make sure these statements are above the existing $(call import-module,./prebuilt-mk) statement, if you are using the pre-built libraries.

Modify Application.mk (Cocos2d-x v3.0 to v3.2 only)

Edit <project_root>/jni/Application.mk to make sure APP_STL is defined correctly. If Application.mk contains APP_STL := c++_static, it should be changed to:

APP_STL := gnustl_static

Copy all source and header files from plugin/jsbindings/ to your projects Classes folder.

NOTE: plugin/jsbindings/jsb2 for creator 1.7.

Add all .cpp files, that you just copied, to Android.mk in the LOCAL_SRC_FILES section. Example

LOCAL_SRC_FILES := hellocpp/main.cpp \
                  ../../Classes/AppDelegate.cpp \
                  ../../Classes/HelloWorldScene.cpp \