How to show interstitial ads?
@Override
protected void onCreate(Bundle savedInstanceState) {
//Log.v("SDL", "onCreate()");
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId("ca-app-pub-2188258702xxxxxxxxxxx");
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("XXXXXXXXXXXXX")
.build();
interstitial.loadAd(adRequest);
// So we can call stuff from static callbacks
mSingleton = this;
// Set up the surface
mEGLSurface = EGL10.EGL_NO_SURFACE;
mSurface = new SDLSurface(getApplication());
mLayout = new AbsoluteLayout(this);
mLayout.addView(mSurface);
setContentView(mLayout);
}
public void displayInterstitial() {
if (interstitial.isLoaded()) {
interstitial.show();
}
}
I use sdl2 for android, and I trying to show interstitial ads in my app, but it's doesn't show. If I comment this line setContentView(mLayout); and call displayinterstitial() all works fine, except all sdl native content(screen is black):-)
And question is How to make work interstitial ads with sdl on android?
Full SDLActivity code here: http://pastebin.com/DsRRtRS5