Show interstitial ads by calling method from different class? (StartApp)

1.1k views Asked by At

So because I try to monetize game it's a bit more difficult since there is no "public void onCreate" method in java class in which I need to call ads. Adding a banner is no issue for me but it's interstitial ads I can't call. In my main java class I created a method:

public void showInter(){
        startAppAd.showAd();
        startAppAd.loadAd();
    }

So in other class I made "MainClass example = new MainClass();" and when game ends I call "example.showInter()" but ads don't show. Anyone has idea for solution? I can't create StartAppAd object in this class in the normal way at least.

1

There are 1 answers

0
Nadav On

Did you init startAppAd before using it?

private StartAppAd startAppAd = new StartAppAd(this);

You can also use AdEventListener to get a callback for loading the ad and check why the ads are failing: https://github.com/StartApp-SDK/Documentation/wiki/android-advanced-usage#adding-a-callback-when-an-interstitial-ad-is-loaded