Main functions
- Mediation display of Fullscreen Interstitial ad for Geniee SDK from GoogleMobileAds Fullscreen Interstitial advertisement
- Geniee SDK displayed from GoogleMobileAds Fullscreen Interstitial advertisement Callback support for Fullscreen Interstitial advertisement
System operating environment
- Android
- Android SDK 4.1 or later
- iOS
- iOS 9.0 or later
- 64bit for iOS
Development environment
- Unity 2019.2.12f1
- JDK 1.8 or later
- SDK build target 28
Related SDKURL
Plugin Installation Procedure
Geniee Fullscreen Interstitial to Unity GoogleMobileAds Advertisement SDK Describes the Unity Plugin installation procedure.
- Import Google Mobile Ads Unity plugin into Unity project
- Import GNSAdSDK-UnityPlugin-Google-Interstitial plugin to Unity project
- Set Google MobileAds app Id
- Register events for Fullscreen Interstitial advertisement using Plugin API
- Load Fullscreen Interstitial advertisement
- Display of Fullscreen Interstitial advertisement
- About pre-call advertisement
- Test device ID setting method
- About Android package name
1. Import the Google Mobile Ads Unity plugin into the Unity project
- Download the
GoogleMobileAds-v5.4.0.unitypackage
from https://developers.google.com/admob/unity/start. - Open the Unity project that incorporates the plugin.
- Select Assets -> Import Package -> Custom Package from the menu bar.
- Select the downloaded 'GoogleMobileAds-v5.4.0.unitypackage` file.
- Make sure all files' checkboxes are checked and click
Import
.
2. Import GNSAdSDK-UnityPlugin-Google-Interstitial plugin to Unity project
Open the Unity project that incorporates the plugin.
Select Assets -> Import Package -> Custom Package from the menu bar.
Select the
GNSAdSDK-UnityPlugin-Google-Interstitial-5.0.0
file in the folder.Make sure that the check box of the following file is checked and click on
Import
.- PlayServicesResolver
- Editor
- GNDependencies.xml
- Editor
- Plugins
- Android
- AndroidManifest.xml
- mainTemplate.gradle
- Android
- PlayServicesResolver
3. Set Google MobileAds app Id
Please set the app Id from Assets / GoogleMobileAds / Settings..
.
- Check AdMob if you are using AdMob.
- Check AdManager if you are using AdManager.
Please refer to the following site for detailed implementation procedures. https://developers.google.com/admob/unity/start?hl=en
4. Using the Plugin API, register events for Fullscreen Interstitial advertisement
The code below is necessary to create a Fullscreen Interstitial advertisement and register an event. When registering an event, please complete the registration process before loading the Fullscreen Interstitial.
using GoogleMobileAds.Api;
...
private InterstitialAd interstitialAd;
interstitialAd = new InterstitialAd("AdUnitId");
interstitialAd.OnAdLoaded += HandleOnAdLoaded;
interstitialAd.OnAdFailedToLoad += HandleOnAdFailedToLoad;
interstitialAd.OnAdOpening += HandleOnAdOpened;
interstitialAd.OnAdClosed += HandleOnAdClosed;
interstitialAd.OnAdLeavingApplication += HandleOnAdLeftApplication;
public void HandleOnAdLoaded(object sender, EventArgs args)
{
// HandleOnAdLoaded event received
}
public void HandleOnAdFailedToLoad(object sender, AdFailedToLoadEventArgs args)
{
// HandleOnAdFailedToLoad event received
}
public void HandleOnAdOpened(object sender, EventArgs args)
{
// HandleOnAdOpened event received
}
public void HandleOnAdClosed(object sender, EventArgs args)
{
// HandleOnAdClosed event received
}
public void HandleOnAdLeftApplication(object sender, EventArgs args)
{
// HandleOnAdLeftApplication event received
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
AdFailedToLoadEventArgs
possesses the following properties.
public class AdFailedToLoadEventArgs : EventArgs
{
// Message
public string Message { get; set; }
}
2
3
4
5
6
5. Load Fullscreen Interstitial advertisement
Below is the code necessary for loading Fullscreen Interstitial ads.
using GNSAdSDK.Api;
...
private InterstitialAd interstitialAd;
void LoadInterstitialAd()
{
string defaultUnitId = "";
#if UNITY_ANDROID
defaultUnitId = "ここにUnitIdを入れてください";
#elif UNITY_IPHONE
defaultUnitId = "ここにUnitIdを入れてください";
#endif
interstitialAd = new InterstitialAd(defaultUnitId);
AdRequest request = new AdRequest.Builder().Build();
interstitialAd.LoadAd(request);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
- Loading may take more than a few seconds, please load Fullscreen Interstitial ads early.
- If you want to show another Fullscreen Interstitial after the completion of playback of one Fullscreen Interstitial, you need to load again.
6. Display Fullscreen Interstitial advertisement
The code below is necessary for displaying Fullscreen Interstitial advertisement. After loading the Fullscreen Interstitial, you can call ShowAd ()
.
using GNSAdSDK.Api;
...
private InterstitialAd interstitialAd;
void ShowInterstitialAd()
{
// インタースティシャルが表示出来るか確認
if (interstitialAd.IsLoaded())
{
interstitialAd.Show();
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
7. About preload for advertisement
Points to note when you want to load the next ad before showing advertisement
Implement interstitialAd.LoadAd(request);
in the ad close event (HandleOnAdClosed).
8. How to set test device ID
- You can enable test ads during development.
- If you click many advertisements without putting it in the test mode, there is a danger that the account will be invalid.
- Please be sure to delete this setting at the time of actual release.
To set up such a message first check the console or logcat output.
OS output example Android I/Ads: Use AdRequest.Builder.addTestDevice("YOUR_TEST_DEVICE_ID") iOS request.testDevices = @[ "YOUR_TEST_DEVICE_ID" ]; Add the AddTestDevice method to the Request.
AdRequest request = new AdRequest.Builder()
.AddTestDevice("YOUR_TEST_DEVICE_ID")
.Build();
interstitialAd.LoadAd(request);
2
3
4
5
9. About Android package name
Please correct package name in Assets/Plugins/Android/AndroidManifest.xml
as appropriate.
package="jp.co.geniee.GNSUnitySampleDfpFullscreen Interstitial"
2