• Your App needs to formulate a "Privacy Policy", display the "Privacy Policy" when users launch the App for the first time, and obtain user consent. For the "Privacy Policy" formulated by the App, please refer to "Privacy Compliance Guide" please make sure that the user agrees to the App's "Privacy Policy" , and then initialize TopOn SDK.
Class name: ATCocosSdk.h
Description: The following is the common API for Android & iOS
| API | Parameter description | Function description |
|---|---|---|
| integrationChecking | - | Check whether the SDK correctly integrates the SDK of the advertising platform |
| initSDK | const char * appId, const char * appKey | Initialize SDK How to obtain App Key? |
| setDebugLog | bool value | Open debug mode for SDK to view more logs |
| setChannel | const char * channel | Configure the channel number information of the SDK |
| setSubChannel | const char * subChannel | Configure the sub-channel number information of the SDK |
| setCustomData | cocos2d::ValueMap customData | Configure custom parameters, which can be used to customize traffic grouping. The keys reserved by TopOn custom rules can be viewed Documentation. |
| setPlacementCustomData | cocos2d::ValueMap customData | Configure custom parameters for ad slot dimensions |
| getUserLocation | ATCocosUserLocationListener * listener | Determine whether it is in the European Union ATCocosSdk::USER_LOCATION_UNKNOWN:Unknown ATCocosSdk::USER_LOCATION_IN_EU:In the European Union ATCocosSdk::USER_LOCATION_OUT_OF_EU:In a non-EU region |
| setGDPRLevel | int level | Please refer to iOS platform or Android platform For the EU region, set GDPR privacy level ATCocosSdk::GDPR_PERSONALIZED: Full personalization ATCocosSdk::GDPR_NONPERSONALIZED: No device information collected, no personalization ATCocosSdk::GDPR_UNKNOWN: Unknown |
| getGDPRLevel | - | Get GDPR Privacy Level ATCocosSdk::GDPR_PERSONALIZED: Fully Personalized ATCocosSdk::GDPR_NONPERSONALIZED : No device information collected, no personalization ATCocosSdk::GDPR_UNKNOWN: Unknown |
| showGdprAuth | - | Show GDPR authorization Page |
Required for iOS part API
| API | Parameter description | Function description |
|---|---|---|
| getScreenScale | - | Get screen size |
// Test phase opened, please remove when release
ATCocosSdk::setDebugLog(true);
ATCocosSdk::integrationChecking();
ATCocosSdk::setChannel("test_cocos_channel");
ATCocosSdk::setSubChannel("test_cocos_sub_channel");
//custom rule for app
cocos2d::ValueMap customDict;
customDict["custom_data_key"] = "custom_data_value";
ATCocosSdk::setCustomData(customDict);
//custom rule for placmenet
cocos2d::ValueMap plcamentCustomDict;
plcamentCustomDict["placement_custom_data_key"] = "placement_custom_data_value";
ATCocosSdk::setPlacementCustomData(placementId, plcamentCustomDict);
ATCocosSdk::initSDK(appId, appKey);| API | Parameter description | Function description |
|---|---|---|
| getUserLocation | ATCocosUserLocationListener * listener | Determine whether it is in the EU region ATCocosSdk::USER_LOCATION_UNKNOWN: Unknown ATCocosSdk::USER_LOCATION_IN_EU: It is in the EU region ATCocosSdk::USER_LOCATION_OUT_OF_EU: In a non-EU region |
| setGDPRLevel | int level | For the EU region, set the GDPR privacy level ATCocosSdk::GDPR_PERSONALIZED: Fully personalized ATCocosSdk::GDPR_NONPERSONALIZED: No device information collected, no personalization ATCocosSdk::GDPR_UNKNOWN: Unknown |
| getGDPRLevel | - | Get GDPR privacy level ATCocosSdk::GDPR_PERSONALIZED: Full personalization ATCocosSdk::GDPR_NONPERSONALIZED: No device information collected , no personalization ATCocosSdk::GDPR_UNKNOWN: Unknown |
| showGdprAuth | - | Display GDPR authorization page |
| isEUTraffic | - | Determine whether it is an EU country |
//check is in EU
ATCocosSdk::getUserLocation(this);
CCLOG("DemoMainScene::isEUTraffic %s", ATCocosSdk::isEUTraffic()?"YES":"NO");
int gdpr_level = ATCocosSdk::getGDPRLevel();
CCLOG("DemoMainScene::getGDPRLevel %d", gdpr_level);
if (gdpr_level == ATCocosSdk::GDPR_PERSONALIZED) {
CCLOG("DemoMainScene Full personalization");
} else if (gdpr_level == ATCocosSdk::GDPR_UNKNOWN && ATCocosSdk::isEUTraffic() == YES){
CCLOG("DemoMainScene Unknown");
ATCocosSdk::showGdprAuthWithListener(this); // Pop-up authorization
} ;
// ATCocosSdk::setGDPRLevel(0);