Table of Contents ▼

Overview

The Chartboost SDK’s delegate methods allow you to exercise a greater degree of control over your integration. For example, you can:

Log debug messages when your game attempts to load an interstitial.

Prevent ads from showing the first time a user plays your game.

Determine whether a user has clicked an ad or just closed it – and react accordingly.

Prevent an interstitial page appearing when and where it would interfere with your game.

You can view the Chartboost Android SDK methods at your disposal in the documentation located in the doc folder included with your Android SDK download. You can see many of these methods in use in the sample project included in the package.

Static & video interstitial delegate methods

// Called before requesting an interstitial via the Chartboost API server.
public boolean shouldRequestInterstitial(String location)
// Called before an interstitial will be displayed on the screen.
public boolean shouldDisplayInterstitial(String location)
// Called after an interstitial has been displayed on the screen.
public void didDisplayInterstitial(String location)
// Called after an interstitial has been loaded from the Chartboost API
// servers and cached locally.
public void didCacheInterstitial(String location)
// Called after an interstitial has attempted to load from the Chartboost API
// servers but failed.
public void didFailToLoadInterstitial(String location, CBImpressionError error)
// Called after an interstitial has been dismissed.
public void didDismissInterstitial(String location)
// Called after an interstitial has been closed.
public void didCloseInterstitial(String location)
// Called after an interstitial has been clicked.
public void didClickInterstitial(String location)

Don’t make cache or show calls inside didFailToLoad delegates or the universe will implode.

Rewarded video delegate methods

// Called before a rewarded video will be displayed on the screen.
public boolean shouldDisplayRewardedVideo(String location)
// Called after a rewarded video has been displayed on the screen.
public void didDisplayRewardedVideo(String location)
// Called after a rewarded video has been loaded from the Chartboost API
// servers and cached locally.
public void didCacheRewardedVideo(String location)
// Called after a rewarded video has attempted to load from the Chartboost API
// servers but failed.
public void didFailToLoadRewardedVideo(String location, CBImpressionError error)
// Called after a rewarded video has been dismissed.
public void didDismissRewardedVideo(String location)
// Called after a rewarded video has been closed.
public void didCloseRewardedVideo(String location)
// Called after a rewarded video has been clicked.
public void didClickRewardedVideo(String location)
// Called after a rewarded video has been viewed completely and user is eligible for reward.
public void didCompleteRewardedVideo(String location, int reward)
// Implement to be notified of when a video will be displayed on the screen for
// a given CBLocation. You can then do things like mute effects and sounds.
public void willDisplayVideo(String location)

Don’t make cache or show calls inside didFailToLoad delegates or the universe will implode.

Misc. delegate methods

// Called if a click is registered by the app, but the user is not forwarded to the App Store.
public void didFailToRecordClick(String uri, CBClickError error)
//Called after the SDK has been successfully initialized and video prefetching has been completed.
public void didInitialize()
{ Log.i("Chartboost, DID INITIALIZE! ")); }

Don’t make cache or show calls inside didFailToLoad delegates or the universe will implode.

Native ads delegate methods

// Called after a Native Ads object has been loaded from the Chartboost API
// servers and cached locally.
public void didCacheInPlay(String location)
// Called after a Native Ad has attempted to load from the Chartboost API
// servers but failed.
public void didFailToLoadInPlay(String location, CBImpressionError error)

Don’t make cache or show calls inside didFailToLoad delegates or the universe will implode.