- Home /
Google Mobile Ads Interstitial ads is not showing in unity
hi,am downloaded the Google Mobile Ads plugin from their website ,I follow the steps what they have,Banner Ads is Showing but Interstitial Ads is not,Here is my code..
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using GoogleMobileAds.Api;
using GoogleMobileAds;
public class AdsShowTest : MonoBehaviour {
private BannerView bannerView;
private InterstitialAd interstitial;
void Start ()
{
DontDestroyOnLoad(this);
RequestBanner ();
RequestInterstitial ();
}
public void RequestBanner()
{
#if UNITY_ANDROID
string adUnitId = "ca-app-pub-3940256099942544/6300978111";
#elif UNITY_IPHONE
string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
#else
string adUnitId = "unexpected_platform";
#endif
// Create a 320x50 banner at the top of the screen.
BannerView bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the banner with the request.
bannerView.LoadAd(request);
//bannerView.Show();
}
private void RequestInterstitial()
{
#if UNITY_ANDROID
string adUnitId = "ca-app-pub-3940256099942544/1033173712";
#elif UNITY_IPHONE
string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
#else
string adUnitId = "unexpected_platform";
#endif
// Initialize an InterstitialAd.
InterstitialAd interstitial = new InterstitialAd(adUnitId);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the interstitial with the request.
interstitial.LoadAd(request);
print("Ad is Loaded");
if (interstitial.IsLoaded())
{
interstitial.Show();
print("Ad is Showing");
}
}
void Update ()
{
if(Input.GetKeyDown(KeyCode.Escape))
Application.Quit();
}
}
i Modify the Ad Manifest also, Please tell me what am doing wrong.Thanks
Am using Android Platform,Here i add the line what u say ,but this one also not working,here is my Xml code
<?xml version="1.0" encoding="utf-8"?>
<!--
This Google $$anonymous$$obile Ads plugin library manifest will get merged with your
application's manifest, adding the necessary activity and permissions
required for displaying ads.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.unity"
android:versionName="1.0"
android:versionCode="1">
<uses-sdk android:$$anonymous$$SdkVersion="9"
android:targetSdkVersion="19" />
<!-- Google $$anonymous$$obile Ads Permissions -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWOR$$anonymous$$_STATE"/>
<application>
<!-- Denote the referenced Google Play services version -->
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true"/>
<!-- Google $$anonymous$$obile Ads Activity -->
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|ui$$anonymous$$ode|screenSize|smallestScreenSize"/>
</application>
</manifest>
No, i didnt used this plugin, bcoz it shows tags, you have to buy this to remove that tag"message tag",
Answer by sillanstudios · Jun 01, 2015 at 04:19 PM
What platform are you developing for? Android? Maybe check the Androidmanifest.xml and make sure ForwardNativeEventsToDalvik is set to true.
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
Ok am given up for this and am using this free plugin..it works fine for me,
Whats the Name of this free Plugin and where can i find it
@$$anonymous$$arios In case you missed it there is a link in babji3's comment to the free addon, http://forum.unity3d.com/threads/admob-unity-plug-in-use-google-play-services-support-interstitial.236156/
By all accounts this is quite a good package, however I haven't used it myself.
Your answer
Follow this Question
Related Questions
Unity Admob Banner is not clickable. 0 Answers
Can't set ForwardNativeEventsToDalvik to true? 1 Answer
Why does my AdMob banner not appear on my Samsung TabA? 0 Answers
Android Banner disappears after touching the screen 2 Answers
Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define 0 Answers