Overview
Cocos Creator built-in Cocos engine includes AnySDK Framework libraries since version 1.2. The chapter introduces how to integrate AnySDK .You can view it Official Wiki to learn More information about AnySDK.
Create a game
AnySDK for Cocos Creator plugin has not been released, you need to download AnySDK client from AnySDK Website to create a game and package.
- Login AnySDK client.
- Create new game.
- Obtain appkey appsecret privatekey.
You can view it AnySDK Client Manual to learn More information about AnySDK client.
Server
If the developer needs to integrate User and IAP system, the game server must deal with verification and payment attestation related logic, refer to the following two documents for access.
Client
Built project
Click menu project -> Built, Cocos Creator built-in Cocos engine includes AnySDK Framework libraries.
Invoke initialize interface
No need to invoke initialize interface,but the developer need to modify the loadAllPlugins
function of frameworks/runtime-src/Classes/SDKManager.cpp
file and add appKey、appSecret、privateKey、oauthLoginServer parameters.
// frameworks/runtime-src/Classes/SDKManager.cpp
std::string oauthLoginServer = "OAUTH_LOGIN_SERVER";
std::string appKey = "APP_KEY";
std::string appSecret = "APP_SERCRET";
std::string privateKey = "PRIVATE_KEY";
AgentManager* pAgent = AgentManager::getInstance();
pAgent->init(appKey,appSecret,privateKey,oauthLoginServer);
//Initialize plug-ins, including SDKs.
pAgent->loadAllPlugins();
appKey, appSecret and privateKey are the only three parameters generated after the packing tool client finishes creating the game.The oauthLoginServer parameter is the API address provided by the game service login verification
Note: if the parameters of
init
function is different from packaged game, APK will be crashed.
Invoke Interface
According to the requirements of the game,refer to the following document to invoke the interface of each system.
- User System
- IAP System
- Analytics System
- Share System
- Ads System
- Push System
- Crash System
- AdTracking System
Package
- Android: Compile project and generate APK, APK is used to be packaged APK.
- iOS: Xcode project is used to be packaged project.
H5: No need to package, only need to config channel parameters.
- Add channel and SDK in AnySDK client.
- Config SDK parameters what you need to obtain from SDK background.
- Choose game APK to package.