Callbacks

General listeners

Loaded Tapdaq config

Called immediately after the SDK is ready to begin loading adverts. Create a subclass of TMInitListener and override the didInitialise() method.

public class TapdaqInitListener extends TMInitListener {

    @Override
    public void didInitialise() {
        super.didInitialise();
        // Ads may now be requested
    }
    
    @Override
    public void didFailToInitialise(TMAdError error) {
        super.didFailToInitialise(error);
        // Tapdaq has failed to initalise
    }
}

Next, instantiate the listener class when you initialise Tapdaq, like so:

Tapdaq.getInstance().initialize(this, "<APP_ID>", "<CLIENT_KEY>", config, new TapdaqInitListener());

Advert listeners

Loaded an advert

Called immediately after an interstitial is available to the user.

@Override
public void didLoad() {
    // ad has loaded
}

Supports: interstitial, video, rewarded video, banner, native ads

Loaded an advert

Called immediately after a mediate native ad is available to the user.

@Override
public void didLoad(TDMediatedNativeAd ad) {
    // ad has loaded
}

Supports: mediated native ads

Failed to load an advert

Called when the advert was not able to be loaded.

@Override
public void didFailToLoad(TMAdError error) {
    // failed to load an ad
}

Support: interstitial, video, rewarded video, banner, native ads

Refreshed an advert

Called when a banner refreshes

@Override
public void didRefresh() {
    // ad has refreshed
}

_Supports: banner

About to display an advert

Called immediately before the advert is to be displayed to the user.

@Override
public void willDisplay() {
    // ad will display
}

Supports: interstitial, video, rewarded video

Displayed an advert

Called immediately after the advert is displayed to the user.

@Override
public void didDisplay() {
    // ad did display
}

Supports: interstitial, video, rewarded video

Fail to Display an advert Called after show when ad is unavailable or unable to display.

public void didFailToDisplay(TMAdError error) {
    // ad failed to display
}

Supports: interstitial, video, rewarded video

Advert closed

Called when the user closes the advert.

@Override
public void didClose() {
    // interstitial closed
}

Supports: interstitial, video, rewarded video

User clicked an advert

Called when the user clicks the advert.

@Override
public void didClick() {
    // user clicked the interstitial
}

Supports: interstitial, video, rewarded video, banner, native ads

More apps listeners

More apps loaded

Called immediately after the more apps content is loaded Create a subclass of TMMoreAppsListener and override the didLoad() method.

public class MoreAppsListener extends TMMoreAppsListener {

    @Override
    public void didLoad() {
        // Ready to display more apps popup
    }

}

You can instantiate this listener class when loading and showing the More Apps popup, like so:

// To load..
Tapdaq.getInstance().loadMoreApps(<CurrentActivity>, new TMMoreAppsConfig(), new MoreAppsListener());

// To show..
Tapdaq.getInstance().showMoreApps(<CurrentActivity>, new MoreAppsListener());

More apps failed to load

Called when the more apps popup was not able to be loaded.

@Override
public void didFailToLoad(TMAdError error) {
    // failed to load more apps popup
}

More apps about to display to the user

Called immediately before the more apps popup is to be displayed to the user.

@Override
public void willDisplay() {
    // more apps will display..
}

More apps did display to the user

Called immediately after the more apps popup is displayed to the user.

@Override
public void didDisplay() {
    // more apps popup did display
}

More apps was closed

Called when the user closes the more apps popup.

@Override
public void didClose() {
    // more apps popup closed
}

Custom Events

For all other events, didCustomEvent will be called with a specialised data set for that event.

@Override
public void didCustomEvent(Map<Object, Object> eventData) {

}

Supports: offerwall

Rewarded video listeners

Received a reward for the user

Called when a reward is ready for the user.

@Override
public void didVerify(TDReward) {
    // user is rewarded
}

Failed to give a reward to the user

Called if an error occurred when rewarding the user.

@Override
public void didFail(TMAdError error) {
    // failed to give the user a reward
}

User did not want to watch the video

Called when the user did not want to watch the video.

@Override
public void onUserDeclined() {

}