LiveOps with cocos creator

LiveOps with cocos creator lacks documents. can you guys please provide more information on the topic?

http://docs.sdkbox.com/en/liveops/

edit frameworks/runtime-src/Classes/AppDelegate.cpp

#include "SDKBoxJSHelper.h"
sc->addRegisterCallback(register_all_SDKBoxJS_helper);

http://docs.sdkbox.com/en/liveops/remote-config/#setup-app-to-use-remote-config

c++ with AppDelegate.cpp

sdkbox::init( <application_token>, <application_secret> <store_name> <debug_environment>);

or js with your game logic

sdkbox.init( <application_token>, <application_secret> <store_name> <debug_environment>);

Is it clear?

1 Like

actually, you can only use cpp code.

1 Like

meaning it wont work with cocos creator?

no.

using sdkbox::init( <application_token>, <application_secret> <store_name> <debug_environment>); with AppDelegate.cpp with work with cocos2d-x,cocos2d-js,cocos2d-lua,creator.

if you want to do some logic with js code, need to register sdkbox.init to js with code:

#include "SDKBoxJSHelper.h"
sc->addRegisterCallback(register_all_SDKBoxJS_helper);

thanks,

2 Likes

so i finally was testing it and this error is what i got

[armeabi-v7a] Compile++ arm  : cocos2djs_shared <= main.cpp
[armeabi-v7a] Compile++ arm  : cocos2djs_shared <= AppDelegate.cpp
[armeabi-v7a] Compile++ arm  : cocos2djs_shared <= jsb_module_register.cpp
C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/jni/../../../Classes/AppDelegate.cpp:63:1: error: unknown type name 'sc'
sc->addRegisterCallback(register_all_SDKBoxJS_helper);
^
C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/jni/../../../Classes/AppDelegate.cpp:63:3: error: cannot use arrow operator on a type
sc->addRegisterCallback(register_all_SDKBoxJS_helper);
  ^
C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/jni/../../../Classes/AppDelegate.cpp:68:9: error: C++ requires a type specifier for all declarations
sdkbox::init("SECRETSECRETS436623cb7", "SECRETSECRETS14172", "googleplay");
        ^
C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/jni/../../../Classes/AppDelegate.cpp:68:9: error: no member named 'init' in namespace 'sdkbox'
sdkbox::init("SECRETSECRETS1c436623cb7", "SECRETSECRETS172", "googleplay");
~~~~~~~~^
4 errors generated.
make: *** [C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/cocos2djs_shared/__/__/__/Classes/AppDelegate.o] Error 1
make: *** Waiting for unfinished jobs....
:TheBalloon:externalNativeBuildRelease FAILED
:TheBalloon:externalNativeBuildRelease (Thread[Daemon worker Thread 4,5,main]) completed. Took 12.722 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':TheBalloon:externalNativeBuildRelease'.
> Build command failed.
  Error while executing process C:\Users\m\AppData\Local\Android\Sdk\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\runtime-src\proj.android-studio\app\jni\Android.mk NDK_APPLICATION_MK=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\runtime-src\proj.android-studio\app\jni\Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=0 APP_PLATFORM=android-16 NDK_OUT=C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\runtime-src\proj.android-studio\app\build\intermediates\ndkBuild\release\lib NDK_TOOLCHAIN_VERSION=clang NDK_MODULE_PATH=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\cocos2d-x;C:\Musab\projects\theballoon\v7\jsb-default\frameworks\cocos2d-x\cocos;C:\Musab\projects\theballoon\v7\jsb-default\frameworks\cocos2d-x\external -j2 NDK_DEBUG=0 C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libcocos2djs.so}
  [armeabi-v7a] Compile++ arm  : cocos2djs_shared <= main.cpp
  [armeabi-v7a] Compile++ arm  : cocos2djs_shared <= AppDelegate.cpp
  [armeabi-v7a] Compile++ arm  : cocos2djs_shared <= jsb_module_register.cpp
  C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/jni/../../../Classes/AppDelegate.cpp:63:1: error: unknown type name 'sc'
  sc->addRegisterCallback(register_all_SDKBoxJS_helper);
  ^
  C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/jni/../../../Classes/AppDelegate.cpp:63:3: error: cannot use arrow operator on a type
  sc->addRegisterCallback(register_all_SDKBoxJS_helper);
    ^
  C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/jni/../../../Classes/AppDelegate.cpp:68:9: error: C++ requires a type specifier for all declarations
  sdkbox::init("SECRETSECRETS436623cb7", "SECRETSECRETS4172", "googleplay");
          ^
  C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/jni/../../../Classes/AppDelegate.cpp:68:9: error: no member named 'init' in namespace 'sdkbox'
  sdkbox::init("SECRETSECRETSc436623cb7", "SECRETSECRETS172", "googleplay");
  ~~~~~~~~^
  4 errors generated.
  make: *** [C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/cocos2djs_shared/__/__/__/Classes/AppDelegate.o] Error 1
  make: *** Waiting for unfinished jobs....


* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 21s
47 actionable tasks: 1 executed, 46 up-to-date
Error running command, return code: 1.

this is what i wrote iny my appdelegate.cpp file

#include "SDKBoxJSHelper.h"
sc->addRegisterCallback(register_all_SDKBoxJS_helper);

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
sdkbox::init("SECRETSTUFF6a7c212ab", "SECRETSTUFF223597");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
sdkbox::init("SECRETSTUFF436623cb7", "SECRETSTUFF14172", "googleplay");
#endif

plz add

#include "sdkbox/sdkbox.h"
1 Like

i got this now?

externalNativeBuildRelease: not building target cpufeatures because it isn't in targets set
Build cocos2djs armeabi-v7a
externalNativeBuildRelease: Executable : C:\Users\m\AppData\Local\Android\Sdk\ndk-bundle\ndk-build.cmd
arguments : 
NDK_PROJECT_PATH=null
APP_BUILD_SCRIPT=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\runtime-src\proj.android-studio\app\jni\Android.mk
NDK_APPLICATION_MK=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\runtime-src\proj.android-studio\app\jni\Application.mk
APP_ABI=armeabi-v7a
NDK_ALL_ABIS=armeabi-v7a
NDK_DEBUG=0
APP_PLATFORM=android-16
NDK_OUT=C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj
NDK_LIBS_OUT=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\runtime-src\proj.android-studio\app\build\intermediates\ndkBuild\release\lib
NDK_TOOLCHAIN_VERSION=clang
NDK_MODULE_PATH=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\cocos2d-x;C:\Musab\projects\theballoon\v7\jsb-default\frameworks\cocos2d-x\cocos;C:\Musab\projects\theballoon\v7\jsb-default\frameworks\cocos2d-x\external
-j2
NDK_DEBUG=0
C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libcocos2djs.so
jvmArgs : 


Executable : C:\Users\m\AppData\Local\Android\Sdk\ndk-bundle\ndk-build.cmd
arguments : 
NDK_PROJECT_PATH=null
APP_BUILD_SCRIPT=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\runtime-src\proj.android-studio\app\jni\Android.mk
NDK_APPLICATION_MK=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\runtime-src\proj.android-studio\app\jni\Application.mk
APP_ABI=armeabi-v7a
NDK_ALL_ABIS=armeabi-v7a
NDK_DEBUG=0
APP_PLATFORM=android-16
NDK_OUT=C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj
NDK_LIBS_OUT=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\runtime-src\proj.android-studio\app\build\intermediates\ndkBuild\release\lib
NDK_TOOLCHAIN_VERSION=clang
NDK_MODULE_PATH=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\cocos2d-x;C:\Musab\projects\theballoon\v7\jsb-default\frameworks\cocos2d-x\cocos;C:\Musab\projects\theballoon\v7\jsb-default\frameworks\cocos2d-x\external
-j2
NDK_DEBUG=0
C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libcocos2djs.so
jvmArgs : 


Starting process 'command 'C:\Users\m\AppData\Local\Android\Sdk\ndk-bundle\ndk-build.cmd''. Working directory: C:\Musab\projects\theballoon\v7\jsb-default\frameworks\runtime-src\proj.android-studio\app Command: C:\Users\m\AppData\Local\Android\Sdk\ndk-bundle\ndk-build.cmd NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\runtime-src\proj.android-studio\app\jni\Android.mk NDK_APPLICATION_MK=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\runtime-src\proj.android-studio\app\jni\Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=0 APP_PLATFORM=android-16 NDK_OUT=C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\runtime-src\proj.android-studio\app\build\intermediates\ndkBuild\release\lib NDK_TOOLCHAIN_VERSION=clang NDK_MODULE_PATH=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\cocos2d-x;C:\Musab\projects\theballoon\v7\jsb-default\frameworks\cocos2d-x\cocos;C:\Musab\projects\theballoon\v7\jsb-default\frameworks\cocos2d-x\external -j2 NDK_DEBUG=0 C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libcocos2djs.so
Successfully started process 'command 'C:\Users\m\AppData\Local\Android\Sdk\ndk-bundle\ndk-build.cmd''
[armeabi-v7a] Compile++ arm  : cocos2djs_shared <= main.cpp
[armeabi-v7a] Compile++ arm  : cocos2djs_shared <= AppDelegate.cpp
[armeabi-v7a] Compile++ arm  : cocos2djs_shared <= jsb_module_register.cpp
C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/jni/../../../Classes/AppDelegate.cpp:62:10: warning: non-portable path to file '"sdkbox/Sdkbox.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#include "sdkbox/sdkbox.h"
         ^~~~~~~~~~~~~~~~~
         "sdkbox/Sdkbox.h"
C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/jni/../../../Classes/AppDelegate.cpp:67:9: error: C++ requires a type specifier for all declarations
sdkbox::init("0S36623cb7", "3bS64f814172", "googleplay");
        ^
1 warning and 1 error generated.
make: *** [C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/cocos2djs_shared/__/__/__/Classes/AppDelegate.o] Error 1
make: *** Waiting for unfinished jobs....
:TheBalloon:externalNativeBuildRelease FAILED
:TheBalloon:externalNativeBuildRelease (Thread[Daemon worker,5,main]) completed. Took 44.915 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':TheBalloon:externalNativeBuildRelease'.
> Build command failed.
  Error while executing process C:\Users\m\AppData\Local\Android\Sdk\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\runtime-src\proj.android-studio\app\jni\Android.mk NDK_APPLICATION_MK=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\runtime-src\proj.android-studio\app\jni\Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=0 APP_PLATFORM=android-16 NDK_OUT=C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\runtime-src\proj.android-studio\app\build\intermediates\ndkBuild\release\lib NDK_TOOLCHAIN_VERSION=clang NDK_MODULE_PATH=C:\Musab\projects\theballoon\v7\jsb-default\frameworks\cocos2d-x;C:\Musab\projects\theballoon\v7\jsb-default\frameworks\cocos2d-x\cocos;C:\Musab\projects\theballoon\v7\jsb-default\frameworks\cocos2d-x\external -j2 NDK_DEBUG=0 C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libcocos2djs.so}
  [armeabi-v7a] Compile++ arm  : cocos2djs_shared <= main.cpp
  [armeabi-v7a] Compile++ arm  : cocos2djs_shared <= AppDelegate.cpp
  [armeabi-v7a] Compile++ arm  : cocos2djs_shared <= jsb_module_register.cpp
  C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/jni/../../../Classes/AppDelegate.cpp:62:10: warning: non-portable path to file '"sdkbox/Sdkbox.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
  #include "sdkbox/sdkbox.h"
           ^~~~~~~~~~~~~~~~~
           "sdkbox/Sdkbox.h"
  C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/jni/../../../Classes/AppDelegate.cpp:67:9: error: C++ requires a type specifier for all declarations
  sdkbox::init("0cbS36623cb7", "S4172", "googleplay");
          ^
  1 warning and 1 error generated.
  make: *** [C:/Musab/projects/theballoon/v7/jsb-default/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/cocos2djs_shared/__/__/__/Classes/AppDelegate.o] Error 1
  make: *** Waiting for unfinished jobs....


* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 38s
47 actionable tasks: 1 executed, 46 up-to-date
Error running command, return code: 1.

appdelegate

#include "sdkbox/sdkbox.h"

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
sdkbox::init("ccSb006a7c212ab", "aaS223597");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
sdkbox::init("S45bef1c436623cb7", "3S814172", "googleplay");
#endif

@yinjimmy hey any ideas?

if you use cocos >= 3.17: plz try

cocos run -p android --build-type ndk-build
1 Like

im using cocos creator v2.0.8

what i think is wrong that here in http://docs.sdkbox.com/en/liveops/#setup-liveops
it says 2.Integrate service plugins with your app automatically with the installer, or manually by downloading the bundles.

and i dont know how to do that with cocos creator and couldnt find the bundles either

how to use SDKBox with cocos creator

http://docs.sdkbox.com/en/qa/cocos_creator/

1 Like

i do have sdkbox installed i mean i use multiple plugins is liveops supposed to be in the import list ? because i cant see it

there is no loveops plugin in the plugin list.
it’s sdkbox core feature.

1 Like

that means i can just use the javascript code inside onLoad function right?

this one
sdkbox.init( <application_token>, <application_secret> <store_name> <debug_environment>);

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

#include "SDKBoxJSHelper.h"

se->addRegisterCallback(register_all_SDKBoxJS_helper);

then you can use sdkbox.init () in js.

1 Like

I checked with cocos creator 2.1

#ifdef SDKBOX_ENABLED
#include "PluginAdMobJS.hpp"
#include "PluginAdMobJSHelper.h"
#include "sdkbox/Sdkbox.h"   // add line
#endif


#ifdef SDKBOX_ENABLED
    se->addRegisterCallback(register_all_PluginAdMobJS);
    se->addRegisterCallback(register_all_PluginAdMobJS_helper);

    sdkbox::init("","");  // live ops
#endif
Skipping task ':hello_world:assembleRelease' as it has no actions.
:hello_world:assembleRelease (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 0.0 secs.

BUILD SUCCESSFUL in 9m 24s
60 actionable tasks: 60 executed
Move apk to /Users/admin/test/ccc_admob/build/jsb-link/publish/android
Build succeed.
1 Like

Never mind thanks im trying now

no, if you use js sdkbox.init();
yes, if you use c++ sdkbox::init();

1 Like

build was successful thanks :heart:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.