Follow

Advanced Usage - Using banner delegates

View original article on our GitHub

You can get various callbacks from StartApp Ads, by implementing a callback method and pass it when loading the ad.

  1. Add the following line to your header file where you would like to catch callbacks:

    static void STACallbacks(const char *eventName , const char *eventError);
  2. Then, implement the STACallbacks callback function with all needed callbacks, in the relevant cpp file. For example:

    void HelloWorld::STACallbacks(const char *eventName , const char *eventError)
    {
      if(0==strcmp(eventName, "didLoadAd")){
          ...
      }   
      else if(0==strcmp(eventName, "didShowAd")){
          ...
      }
      else 
          ...
    }
  3. Pass STACallbacks when loading the ad:
    For Splash:

    startAppBridge->showSplashAd(STACallbacks);

    For Interstitial:

    startAppBridge->loadAd(STACallbacks);

    For Banner:

    startAppBridge->loadBanner(startappiOS::STAAdOrigin_Bottom, 
                              startappiOS:: STA_AutoAdSize, 
                              STACallbacks);

Callbacks List

Splash callbacks

didLoadSplashAd
failedLoadSplashAd
didShowSplashAd
failedShowSplashAd
didCloseSplashAd
didClickSplashAd

Interstitial callbacks

didLoadAd
failedLoadAd
didShowAd
failedShowAd
didCloseAd
didClickAd

Banner callbacks

didDisplayBannerAd
failedLoadBannerAd
didClickBannerAd

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments