[size=small] Integrating Admob in Android Unity Game Integrated Full Screen Advertising Tutorial
[/size]
How to integrate Admob full screen ads in Unity applications? The code for adding admob ads in Unity3d below is
using admob;
...
Admob.Instance().initAdmob("admob banner id", "admob interstitial id");//initAdmob just need call once, if you called when create banner ,you not need call any more
Admob.Instance().loadInterstitial(); Unlike
banner ads, full-screen ads need to be loaded first, and the ads will be displayed at a suitable time after the loading is complete
if (Admob.Instance().isInterstitialReady() ) {
Admob.Instance().showInterstitial();
}
You can also listen to and handle all admob ad events in unity3d
The following is an example of handling full screen ad events, we display ads when we receive them
using admob;
. ..
Admob.Instance().interstitialEventHandler += onInterstitialEvent;
...
void onInterstitialEvent(string eventName, string msg)
{
Debug.Log("handler onAdmobEvent---" + eventName + " " + msg);
if (eventName == AdmobEvent.onAdLoaded)
{
Admob.Instance().showInterstitial();
}
}
Admob Unity Plugin 官方地址 https://github.com/unity-plugins/Unity-Admob