Class name: ATCocosSdk
| API | Parameter Description | Function Description |
|---|---|---|
| loadInterstitialAd | const char * placementId | Used to load interstitial ads, unitId is the advertising slot id |
| showInterstitialAd | const char * placementId | Display interstitial ads in the specified ad slot |
| showInterstitialAdInScenario | const char * parameters, const char * scenario | Displays interstitial ads in designated ad slots, where scenario is the ad display scene, and scene parameters can be created from the background |
| isInterstitialAdReady | const char * parameters | Determine whether the ads in the specified ad slot have been loaded |
| checkInterstitialAdStatus | const char * placementId | Get the current Status of the ad slot (Json string): 1. isLoading: whether it is loading 2. isReady: whether there is an ad cache (same function as isInterstitialAdReady) 3. AdInfo: the current highest priority ad Cache information |
| setInterstitialAdListener | ATCocosInterstitialAdListener * listener | Set callback object |
Interface: ATCocosInterstitialAdListener
| API | Parameters Description | Function description |
|---|---|---|
| onInterstitalLoadSuccess | const char * placementId | Ad loading completed |
| onInterstitalLoadFailed | const char * placementId, const char * errorString | Ad loading failed errorString failed to load Reason |
| onInterstitalClickedWithExtra | const char * placementId, const char * extra | The ad generates clicks extra contains other information about the current ad |
| onInterstitalShowWithExtra | const char * placementId,const char * extra | Ad display extra contains other information about the current ad |
| onInterstitalCloseWithExtra | const char * placementId,const char * extra | Ad close extra contains other information about the current ad |
| onInterstitalPlayStartWithExtra | const char * placementId,const char * extra | The video starts playing extra contains additional information about the current ad |
| onInterstitalPlayEndWithExtra | const char * placementId,const char * extra | Video ends extra contains other information about the current ad |
1. Load advertisement
ATCocosSdk::setInterstitialAdListener(this, interPlacementId);
//For Sigmob,Sigmob's rewarded video AD feed is used as a interstitial ad
cocos2d::ValueMap extra;
//extra[ATCocosSdk::KEY_USE_REWARDED_VIDEO_AS_INTERSTITIAL] = false;
extra[ATCocosSdk::KEY_USE_REWARDED_VIDEO_AS_INTERSTITIAL] = true;
ATCocosSdk::loadInterstitialAd(interPlacementId, extra); 2. Display advertising
if(ATCocosSdk::isInterstitialAdReady(interPlacementId)){
ATCocosSdk::showInterstitialAd(interPlacementId);
// Scenario show
//ATCocosSdk::showInterstitialAd(interPlacementId, YourScenario);
}else{
CCLOG("ATCocosSdk::isInterstitialAdReady is false");
}