-1

I have implemented admob banners in my app already, and now I would like to implement Intersitial ads. The code is written in Obj-C++. Here is the code I have for the banners:

#import "MyGameBridge.h"
#import "AppController.h"
#import "GameConfig.h"
#include "GADInterstitial.h"

void MyGameBridge::showBanner()
{
AppController* delegate = (AppController*)[UIApplication sharedApplication].delegate;
[delegate openAdmobBannerAds];
}



void MyGameBridge::showAds()
{
AppController* delegate = (AppController*)[UIApplication sharedApplication].delegate;

[delegate initiAdBanner];

}

void MyGameBridge::hideAds()
{
AppController* delegate = (AppController*)[UIApplication sharedApplication].delegate;

[delegate hideBanner];
}

What do I need to code to implement Interstitial ads?

CodeSmile
  • 64,284
  • 20
  • 132
  • 217

1 Answers1

0

Define this in .h file

GADInterstitial *mInterstitial_;

In .m file,

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
   ...
    mInterstitial_ = [[GADInterstitial alloc] init];
    mInterstitial_.adUnitID = ADMOB_FULL_SCREEM_ID;
    [mInterstitial_ loadRequest:[GADRequest request]];
}

//Use below function to call admob interstitial

-(void)showAdmobAdsFullScreen
{
    [mInterstitial_ presentFromRootViewController:self.viewController];

    mInterstitial_ = nil;

    mInterstitial_ = [[GADInterstitial alloc] init];
    mInterstitial_.adUnitID = ADMOB_FULL_SCREEM_ID;
    [mInterstitial_ loadRequest:[GADRequest request]];
}
Guru
  • 21,652
  • 10
  • 63
  • 102