Fullscreen interstitial Ad of Google Mobile Ads
Fullscreen interstitial ad is an advertisement "content" By using this feature, GoogleMobileAd's Fullscreen Interstitial will display interstitial advertisements for each ad network with Geniee's mediation.
Preparation for implementation
Add GoogleMobileAds
Add the following to Podfile.
pod 'Google-Mobile-Ads-SDK'
Points to note when introducing GoogleMobileAds
If you are introducing GoogleMobileAds, the application will crash if you do not include the admob or Google Ad Manager app ID information in Info.plist.- App ID information
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-################~##########</string>
<key>SKAdNetworkItems</key>
<array>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>cstr6suwn9.skadnetwork</string>
</dict>
</array>
2
3
4
5
6
7
8
9
Add GNAdGoogleMediationAdapter
Introduce with Cocoapods
Add the following to Podfile.
pod 'Geniee-Google-Mediation-Adapter'
Introduction with manual
About manual installation procedure
- Download GNAdGoogleMediationAdapter.
Copy GNAdGoogleMediationAdapter.xcframework to the project by drag-and-drop.
Select the project from the navigator area, then select "TARGET" => "General"
Add "GNAdGoogleMediationAdapter.xcframework" to "Linked Framework and Libraries".
For GNAdGoogleMediationAdapter 5.1.5 or lower, perform the following steps.
Add "GNAdGoogleMediationAdapter.framework" to "Embedded Binaries".
Common introduction contents
For GNAdGoogleMediationAdapter 5.1.6
and later versions, the following steps are unnecessary.
For GNAdGoogleMediationAdapter 5.1.5 or lower, perform the following steps.
- Select "Pods/***.xcconfig" from the navigator area.
Delete -framework "GoogleMobileAds" from "OTHER_LDFLAGS". - Select a project from the navigator area, then select "TARGETS" -> "Build Settings".
Delete "GoogleMobileAds" from "Other Linker Flags".
Add Geniee SDK
For installation of Geniee SDK, see the start guide.
Add SDK and adapter for each ad network
For fullscreen interstitial, it is necessary to set SDK and adapter for each ad network. Please refer to the introduction method from the link of the ad network from the following.
Ad network | Version |
---|---|
maio | 1.3.0 |
AppLovin | 5.0.1 |
Nend | 5.0.2 |
Zucks | 4.7.8 |
Tapjoy | 12.0.0 |
UnityAds | 2.3.0 |
Vungle | 6.2.0 |
i-mobile | 2.0.29 |
Implementation of fullscreen interstitial
By using the UnitID that set mediation on GoogleAdManager/AdMob management screen, you can display the mediated fullscreen ads.
For details on how to implement the fullscreen, please refer to the following site.
- AdManager (DFP)
How to implement RewardedVideo of GoogleAdManager
- AdMob
How to implement RewardedVideo of AdMob
Response when Google Ad Manager Fullscreen Interstitial Ad is No Fill
If Google Ad Manager's Fullscreen Interstitial fails to load, you can prevent the spill of ads by calling Geniee SDK. The implementation procedure is as follows.
Preparation for implementation
Import GNSFullscreenInterstitialAd of Geniee SDK.
- ObjectiveC
Import the header file and add Delegate.
Example:ViewController.h
#import <GNAdSDK/GNSRequest.h>
#import <GNAdSDK/GNSFullscreenInterstitialAdDelegate.h>
@interface ViewController <GADInterstitialDelegate, GNSFullscreenInterstitialAdDelegate>
2
3
- Swift
Add a header file with the following contents.
#import <GNAdSDK/GNSRequest.h>
#import <GNAdSDK/GNSFullscreenInterstitialAdDelegate.h>
2
Select the project from the navigator area, then select "TARGET" => "Build Settings".
Add path of the header file created above to "Objective-C Bridging Header".
Delegate method implementation
implementation of GNSFullscreenInterstitialAdDelegate.
- ObjectiveC
About Delegate implementation Set Delegate.
[GNSFullscreenInterstitialAd sharedInstance].delegate = self;
To receive notification from the SDK, implement the method of GNSFullscreenInterstitialAdDelegate.
/// Tells the delegate that the interstitial ad failed to load.
- (void)fullscreenInterstitial:(GNSFullscreenInterstitialAd *)fullscreenInterstitialAd
didFailToLoadWithError:(NSError *)error {
}
/// Tells the delegate that the interstitial ad loaded.
- (void)fullscreenInterstitialDidReceiveAd:(GNSFullscreenInterstitialAd *)fullscreenInterstitialAd {
}
/// Tells the delegate that the interstitial ad started showing.
(void)fullscreenInterstitialWillPresentScreen:(GNSFullscreenInterstitialAd *)fullscreenInterstitialAd {
}
/// Tells the delegate that the interstitial ad closed.
- (void)fullscreenInterstitialAdDidClose:(GNSFullscreenInterstitialAd *)fullscreenInterstitialAd {
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
- Swift
About Delegate implementation Set Delegate.
GNSFullscreenInterstitialAd.sharedInstance().delegate = self
To receive notification from the SDK, implement the method of GNSFullscreenInterstitialAdDelegate.
extension ViewController : GNSFullscreenInterstitialAdDelegate {
// Tells the delegate that a interstitial ad was received.
func fullscreenInterstitialDidReceiveAd(_ fullscreenInterstitialAd: GNSFullscreenInterstitialAd!) {
}
// Tells the delegate that the interstitial ad failed to load.
func fullscreenInterstitial(_ fullscreenInterstitialAd: GNSFullscreenInterstitialAd!, didFailToLoadWithError error: Error!) {
}
// Tells the delegate that the interstitial ad started showing.
func fullscreenInterstitialWillPresentScreen(_ fullscreenInterstitialAd: GNSFullscreenInterstitialAd!) {
}
// Tells the delegate that the interstitial ad closed.
func fullscreenInterstitialAdDidClose(_ fullscreenInterstitialAd: GNSFullscreenInterstitialAd!) {
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Load fullscreen interstitial ad
Implement the Geniee SDK full-screen interstitial load method in the method that will be called if the Google Ad Manager load fails.
If you want to show another movie after the completion of playback of one movie, you need to make a load request again.
- ObjectiveC
GAMRequest *request = [GAMRequest request];
[GAMInterstitialAd loadWithAdManagerAdUnitID:@"YOUR_UNIT_ID" request:request completionHandler:^(GAMInterstitialAd *ad, NSError *error) {
if (error) {
GNSRequest *request = [GNSRequest request];
[[GNSFullscreenInterstitialAd sharedInstance] loadRequest:request withZoneID:@"YOUR_SSP_ZONE_ID"];
return;
}
self.interstitial = ad;
self.interstitial.fullScreenContentDelegate = self;
}];
2
3
4
5
6
7
8
9
10
- Swift
let request = GAMRequest()
GAMInterstitialAd.load(withAdManagerAdUnitID: "YOUR_UNIT_ID", request: request, completionHandler: { (ad, error) in
if let error = error {
let request = GNSRequest()
GNSFullscreenInterstitialAd.sharedInstance().load(request, withZoneID: "YOUR_ZONE_ID")
return
}
self.interstitial = ad
self.interstitial.fullScreenContentDelegate = self
})
2
3
4
5
6
7
8
9
10
Display fullscreen interstitial
In the order of Google Ad Manager → Geniee SDK, check whether load is completed, and show ad by show method.
Please be sure to execute show after running Google Ad Manager's Load.
- ObjectiveC
if (self.interstitial) {
[self.interstitial presentFromRootViewController:self];
} else if ([[GNSFullscreenInterstitialAd sharedInstance] canShow]) {
[[GNSFullscreenInterstitialAd sharedInstance] show:self];
}
2
3
4
5
- Swift
if let ad = interstitial {
ad.present(fromRootViewController: self)
} else if GNSFullscreenInterstitialAd.sharedInstance().canShow() {
GNSFullscreenInterstitialAd.sharedInstance().show(self)
}
2
3
4
5