Menu

Interstitial Ads

1. Interstitial ad call instructions

1.1 API description

Class name: ATCocosSdk

APIParameter DescriptionFunction Description
loadInterstitialAdconst char * placementIdUsed to load interstitial ads,
unitId is the advertising slot id
showInterstitialAdconst char * placementIdDisplay interstitial ads in the specified ad slot
showInterstitialAdInScenarioconst char * parameters, const char * scenarioDisplays interstitial ads in designated ad slots, where scenario is the ad display scene, and scene parameters can be created from the background
isInterstitialAdReadyconst char * parametersDetermine whether the ads in the specified ad slot have been loaded
checkInterstitialAdStatus const char * placementIdGet 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
setInterstitialAdListenerATCocosInterstitialAdListener * listenerSet callback object

1.2 Listener callback method description

Interface: ATCocosInterstitialAdListener

APIParameters DescriptionFunction description
onInterstitalLoadSuccessconst char * placementIdAd loading completed
onInterstitalLoadFailedconst char * placementId, const char * errorStringAd loading failed
errorString failed to load Reason
onInterstitalClickedWithExtraconst char * placementId, const char * extraThe ad generates clicks
extra contains other information about the current ad
onInterstitalShowWithExtraconst char * placementId,const char * extraAd display
extra contains other information about the current ad
onInterstitalCloseWithExtraconst char * placementId,const char * extraAd close
extra contains other information about the current ad
onInterstitalPlayStartWithExtraconst char * placementId,const char * extraThe video starts playing
extra contains additional information about the current ad
onInterstitalPlayEndWithExtraconst char * placementId,const char * extraVideo ends
extra contains other information about the current ad

1.3 Calling example

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");
 }


Last modified: 2025-05-30Powered by