App open Ads
App Open ad is a type of mobile advertisement designed to appear when a user opens a mobile app. These ads are full-screen and are typically displayed in a transition moment, such as when an app is launched or brought to the foreground.
This guide shows you how to integrate App open ads into your app.
Load ad
Create an instance of CTSplash, passing in the placementId and calling the loadAd method.
CTAdRequest adRequest = new CTAdRequest.Builder()
.setPlacementId("SPLASH_PLACEMENT_ID")// [necessary] placementId from carty publisher
.setMute(true)// [optional] does video ads mute play, sdk default value true
.build();
CTSplash ctSplash = new CTSplash(adRequest);
ctSplash.loadAd();
val adRequest = CTAdRequest.Builder()
.setPlacementId("SPLASH_PLACEMENT_ID")// [necessary] placementId from carty publisher
.setMute(true)// [optional] does video ads mute play, sdk default value true
.build()
val ctSplash = CTSplash(adRequest)
ctSplash.loadAd()Register Listener
It is recommended to register a listener before calling the CTSplash.loadAd method.
ctSplash.setSplashAdListener(new CTSplashAdListener() {
@Override
public void onLoaded(CTBaseAd baseAd) {
}
@Override
public void onLoadFailed(CTAdError adError) {
}
@Override
public void onShown(CTBaseAd baseAd) {
}
@Override
public void onShowFailed(CTBaseAd baseAd, CTAdError adError) {
}
@Override
public void onClicked(CTBaseAd baseAd) {
}
@Override
public void onClosed(CTBaseAd baseAd) {
}
});
ctSplash.setSplashAdListener(object : CTSplashAdListener {
override fun onLoaded(baseAd: CTBaseAd?) {
}
override fun onLoadFailed(adError: CTAdError?) {
}
override fun onShown(baseAd: CTBaseAd?) {
}
override fun onShowFailed(baseAd: CTBaseAd?, adError: CTAdError?) {
}
override fun onClicked(baseAd: CTBaseAd?) {
}
override fun onClosed(baseAd: CTBaseAd?) {
}
})Display ad
Call showAd on the CTSplash object that you instantiated
ctSplash.showAd(activity);
ctSplash.showAd(activity)Client-side bidding
After the ad loads successfully, you can obtain ecpm by calling CTBaseAd.getEcpm
baseAd.getEcpm();
baseAd.ecpmAfter winning the ad bid, call onC2SBiddingSuccess and pass in the second-highest bid from this bid.
ctSplash.onC2SBiddingSuccess("secondPrice", null);
ctSplash.onC2SBiddingSuccess("$secondPrice", null)After an ad is lost, onC2SBiddingFailed is called with the highest bid received in the auction.
ctSplash.onC2SBiddingFailed("topPrice", null);
ctSplash.onC2SBiddingFailed("$topPrice", null)