Setting up the SDK

Before integrating

Check our "known issues" section if you encounter any integration issue.
Before you can integrate and test the SDK, you must request an SDK hash and set up your devices for testing.

Requesting the SDK hash

The SDK hash is a 32 character hexadecimal string (e.g. 1234567890abcdefgh1234567890abcd). It uniquely identifies your app to the adjoe SDK and must therefore be kept secret. You can obtain it by requesting it from your adjoe contact person.

Setting up test devices

IMPORTANT: This step must be executed before the SDK is initialized for the first time on the affected device! Note that you can always add more devices as test devices in the future, but only if you haven't initialized the SDK on the device before.
To easily test your integration of the adjoe SDK on a certain device, you can set it up as a test device. This device will then receive more apps to install and the rewards are reached faster, making it less cumbersome for you to test the integration.
To set up a device as a test device for adjoe, simply send the device's Google Advertising ID to your adjoe contact person and wait for the confirmation. You can obtain the Google Advertising ID (GAID) of your device by going to Settings > Google > Ads > My Ad-ID.
Note: When you reset the GAID, you must again register the device as a test device with the new GAID.

Add the SDK to your app

Download the latest version of the adjoe SDK for Cocos2dx here: cocos2dx-plugin-adjoe-1.5.1.zip and extract it into your project.
Add the SDK to your app-level build.gradle. When using the default project structure, this is typically located at frameworks/runtime-src/proj.android-studio/app/build.gradle.
1
repositories {
2
mavenCentral()
3
maven {
4
url "https://releases.adjoe.io/maven"
5
}
6
google()
7
jcenter()
8
}
9
10
dependencies {
11
...
12
implementation 'io.adjoe:adjoe-sdk-android:1.5.1'
13
...
14
}
Copied!

Add LUA Bindings

You need to add the bindings for our C++ functions, so that they can be called from LUA. In your AppDelegate.cpp, typically located at frameworks/runtime-src/Classes/AppDelegate.cpp, add the following header:
1
#include "AdjoeDelegate.h"
Copied!
Then, add the call to bind the functions to your applicationDidFinishLaunching function.
1
bool AppDelegate::applicationDidFinishLaunching()
2
{
3
...
4
lua_State* L = engine->getLuaStack()->getLuaState();
5
lua_module_register(L);
6
adjoe::bind_adjoe_lua_functions(L);
7
...
8
}
Copied!

Add Android JNI Bindings

You need to add the bindings for our C++ functions, so that they can be called from Java. In your Android.mk file, typically located at frameworks/runtime-src/proj.android-studio/app/jni/Android.mk, modify LOCAL_SRC_FILES and add the following:
1
LOCAL_SRC_FILES := \
2
<Existing Sources>
3
../../../Classes/AdjoeDelegate.cpp \
4
adjoe/adjoe_jni.cpp
Copied!
Last modified 1mo ago