Reputation: 73
i did a game in IOS mobiles, and i add iAd and when it fails ad-mob will be shown. in my game there is a function called GameOver
Whenever the user loss this function will be called. Now what i want is how i can add advertisement in the whole view when the user loss the advertisement in the whole view will be shown.
As you can see in app-store, there are games when the user loss, a view popup and it contain an advertisement and a video. I tried to do it, but the only thing that I'm getting is a small banner for iAd.
Upvotes: 1
Views: 88
Reputation: 5754
Full screen is known as Interstitial ad.
For showing interstitial ad in Admob:-
Create an adUnitID from Admob, select Interstitial ad in ad type.
- (void)createAndLoadInterstitial
{
self.interstitial = [[GADInterstitial alloc] init];
self.interstitial.adUnitID = @"YOUR_AD_UNIT_ID";
self.interstitial.delegate = self;
GADRequest *request = [GADRequest request];
request.testDevices = ARRAY_OF_TEST_DEVICE_ID;
[self.interstitial loadRequest:request];
}
iAd currently provides full screen ad only for iPad. If you app is running in iPhone there is no any way to show full screen ad via iAd.
Apple's doc for full screen iAd
Upvotes: 1
Reputation: 141
you can use this for full view
- (void)createAndLoadInterstitial
{
self.interstitial = [[GADInterstitial alloc] init];
self.interstitial.adUnitID = @"ca-xxx-xxx-xxxxxxxxxxxxxxxxxxxx";
self.interstitial.delegate = self;
GADRequest *request = [GADRequest request];
request.testDevices = @[
@"xxxxxxxxxxxxxxxxxxxxxxx"
];
[self.interstitial loadRequest:request];
}
#pragma mark GADInterstitialDelegate implementation
- (void)interstitial:(GADInterstitial *)interstitial
didFailToReceiveAdWithError:(GADRequestError *)error {
NSLog(@"interstitialDidFailToReceiveAdWithError: %@", [error localizedDescription]);
}
- (void)interstitialDidDismissScreen:(GADInterstitial *)interstitial{
NSLog(@"interstitialDidDismissScreen");
//do you work
}
and framework - GoogleMobileAds
Upvotes: 0