Set sdkbox_config outside of build dir

i am using cocos creator 2.1
i am building for web, ios and android.
The problem is that i store my admob info on sdkbox_config but i have to put it on each build dir and sometimes it gets deleted on any update.
any way to reference as a whole project file?

web? sdkbox don’t support web platform for now.

follow solution can store sdkbox_config.json in assets folder.

http://docs.sdkbox.com/en/qa/crypt-sdkbox-config/#use-cocos-creators-solution

thank you!

How can i use it for ads ?

i don’t know what’s meaning?

this is just take sdkbox_config.json as a js file, usage is same as sdkbox_config.json

no really
because the file is a js file
const sdkbox_config = require(’…/SDKBox/sdkbox_config’)

then it is called into sdkbox.IAP.init;
sdkbox.IAP.init(JSON.stringify(sdkbox_config));

IAP is for In app

i know. which plugin are you use?

sdkbox.PluginAdMob

ok, we will provider a more common solution, will update this thread when finish.

1 Like
  • modify AppDelegate.cpp like follow:
...
#include "SDKBoxJSHelper.h"
...

bool AppDelegate::applicationDidFinishLaunching()
{
    ...

    jsb_register_all_modules();
    se->addRegisterCallback(register_all_SDKBoxJS_helper);

    ...

    return true;
}

  • move and rename jsb-link/res/sdkbox_config.json to assets/SDKBox/sdkbox_config.js.
  • add module.exports = to assets/SDKBox/sdkbox_config.js at first line
module.exports =
{
    "android": {
        "iap": {
            ...
        }
        ...
    },
    "ios": {
        "iap": {
            ...
        }
        ...
    }
}

  • require sdkbox_config.js, and send json string to sdkbox
const sdkbox_config = require('../SDKBox/sdkbox_config')
...
sdkbox.setConfig(JSON.stringify(sdkbox_config)); // make sure call this before sdkbox pluign init
...
sdkbox.PluginAdMob.init();
...

setConfig doesnt exists

please register by yourself