Code Monkey home page Code Monkey logo

googleads-mobile-unity's Introduction

Google Mobile Ads Unity Plugin

The Google Mobile Ads SDK is the latest generation in Google mobile advertising featuring refined ad formats and streamlined APIs for access to mobile ad networks and advertising solutions. The SDK enables mobile app developers to maximize their monetization in native mobile apps.

This repository contains the source code for the Google Mobile Ads Unity plugin. This plugin enables Unity developers to easily serve Google Mobile Ads on Android and iOS apps without having to write Java or Objective-C code. The plugin provides a C# interface for requesting ads that is used by C# scripts in your Unity project.

Downloads

Please import the plugin using Unity Package Manager or download the package from the GitHub releases page.

Documentation

For instructions on using the plugin, please refer to this developer guide.

For a sample application demonstrating how to use Google Mobile Ads see The HelloWorld Unity project.

Suggesting improvements

To file bugs, make feature requests, or to suggest other improvements, please use github's issue tracker.

Be sure to also join the developer community on our forum.

License

Apache 2.0 License

googleads-mobile-unity's People

Contributors

alexey-unity avatar amyquispe avatar ankit141593 avatar armnotstrong avatar dragmz avatar eamonnmcmanus avatar eldersjavas avatar ericleich avatar gyutaelee avatar halfdevil avatar jillsong avatar joshuajplagonera avatar jweisbaum avatar maddevrelgithubbot avatar maxgabriel avatar napbla avatar pipe-alt avatar rampara avatar rolandszep avatar sbeca avatar srichakradhar avatar stowy avatar thaina avatar tkyaji avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

googleads-mobile-unity's Issues

Error building Player

I get this error when I add the google-play-services_lib folder, located at /extras/google/google_play_services/libproject, into the Plugins/Android folder.

Error building Player: Win32Exception: ApplicationName='C:\Program Files (x86)\Java\jre7\bin\javac.exe', CommandLine='-bootclasspath "D:/adt-bundle-windows-x86_64-20140321/sdk/platforms/android-19\android.jar" -d "D:\Unity Projects\EasyGame\Temp\StagingArea\bin\classes" -source 1.6 -target 1.6 -encoding ascii "com\google\android\gms\R.java" "com\iftah\EasyGame\R.java"', CurrentDirectory='D:\Unity Projects\EasyGame\Temp\StagingArea\gen'

InterstitialAd crashes on Android

InterstitialAd crash on Android:

void initAd()
    {
        // Initialize an InterstitialAd.
        interstitial = new InterstitialAd("ca-app-pub-0222437/4622594");
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the interstitial with the request.
        interstitial.LoadAd(request);
    }

And can't show banner ad on Android:

    void loadBasicBanner()
    {
        AdSize adSize = new AdSize(250, 250);
            // Create a 320x50 banner at the top of the screen.
            BannerView bannerView = new BannerView(
            "ca-app-pub-02423337/4322294", adSize, AdPosition.Bottom);
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the banner with the request.
        bannerView.LoadAd(request);
    }

Fail to load Interstitial

Hi,

When I create ad-unit, interstitial is displayed for first time. However, I open my app after first time, admob returns "no fill" error. How can I solve this?

How to get alive ads on iOS

I build my project to iPhone, without "AdRequest.Builder.AddTestDevice()", but I can still not get alive ad, the Xcode have a message on console: To get test ads on this device, call: request.testDevices

GADUObjectCache.m - ARC forbids explicit message

If I try to build the project these errors occur in GADUObjectCache.m, GADUInterstitial.m ...:

  1. Semantic issue - 'release' is unavailable
  2. ARC Restrictions - ARC forbids explicit message send of 'release'
  3. ARC restrictions - ARC forbids explicit message send of 'dealloc'

These are the marked error lines:
void dealloc{
[_references release];
[super dealloc];
}

I'm using Xcode 6.1.
I added the libraries and the -ObjC flag
I downloaded the latest Google Mobile Ads SDK for iOS.
Tried with Google Mobile Ads Unity Plugin v2.1 -unitypackage file and also with the source files.

Perhaps this is because there is something missing for the iOS 8 support?

Dont show Ads on IOS

Then I press "Request Banner" from Example script,I have error:
EntryPointNotFoundException: GADUCreateSmartBannerView
at (wrapper managed-to-native) GoogleMobileAds.iOS.Externs:GADUCreateSmartBannerView (intptr,string,int)
at GoogleMobileAds.iOS.IOSBannerClient.CreateBannerView (System.String adUnitId, GoogleMobileAds.Api.AdSize adSize, AdPosition position) [0x00017] in E:_dev\dev14_GC_Admob_IOS\Assets\GoogleMobileAds\Platforms\iOS\IOSBannerClient.cs:54
at GoogleMobileAds.Api.BannerView..ctor (System.String adUnitId, GoogleMobileAds.Api.AdSize adSize, AdPosition position) [0x000e4] in E:_dev\dev14_GC_Admob_IOS\Assets\GoogleMobileAds\Api\BannerView.cs:22
at GoogleMobileAdsDemoScript.RequestBanner () [0x00006] in E:_dev\dev14_GC_Admob_IOS\Assets\GoogleMobileAdsDemoScript.cs:81
at GoogleMobileAdsDemoScript.OnGUI () [0x00063] in E:_dev\dev14_GC_Admob_IOS\Assets\GoogleMobileAdsDemoScript.cs:22

I dont know what I can do... Please help..

Can't get the ads to show on android

I followed the directions by putting the prefab into my scene, putting in my ad unit id, and dragging the google play service lib folder into plugins/android but ads are not showing when I test on my phone. I know it's not supposed to work in unity, but I get a JNI Exception from the AndroidJavaClass when I play it in unity. I looked at the logcat of my app and at some point it says that the Google Play Services were not found. Check your project configuration. Then later it says JS: Uncaught ReferenceError: AFMA_buildAdURL is not defined (http://googleads.g.doubleclick.net/:1)

Can't get to work

Hi guys,

I'm having an issue with this plugin. The ads doesn't appear in my app. I've switched over 3 phones, without success.

I follow all the guideline to apply this lib to my Unity Project. First of all, import UnityPackage and copy the folder google-play-services_lib into my Plugin/Android folder ( The structure: Plugin/Android/google-play-services_lib ). With this configuration, I tryied some solutions to get it work properly: Request the banner OnGUI, Awake, Start... Nothing happened.

So, I Realize that I can export the UnityProject as an Android Project and import the files on Eclipse. After that, I realize that the Google Play Service JAR was not packaged with the app. I modify the structure of the Plugins folder, copying the content of google-play-services_lib folder ( The structure now: Plugins/Android/lib - and other folders like res and src ). I keep my old AndroidManifest.xml, and didn't merge the infos from AndroidManifest inside google-play-services_lib folder with my old AndroidManifest.xml. With this new configuration, I exported the Android Project and I could see the Google Play Service JAR packaged inside the libs folder.

Re-test everything and.... No ads. I'm using an id like ca-mb-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx from ADX. This id works with an Adobe AIR application, so the problem it's not with this id.

Can anyone help me? I need these ads :(

Banner Resolution

Hi, I am using this plugin on a game created in Unity3D targeted for android. Everything works fine, the only issue is that I am trying to code my app to leave a blank space in the bottom so the ad doesn't overlaps essential UI on the game. I managed to do that for most of the device resolutions, but still sometimes the resolution of the ad is unexpected. (mostly in some tablets). Can you please tell me how exactly the dimensions of the ad banner are calculated? Thanks.

Exception when starting game

Hello,
Even with the latest version, i'm getting the following error :
Exception: JNI: Init'd AndroidJavaClass with null ptr!

Full stack trace :
Exception: JNI: Init'd AndroidJavaClass with null ptr!
UnityEngine.AndroidJavaClass..ctor (IntPtr jclass)
UnityEngine.AndroidJavaObject.get_JavaLangClass ()
UnityEngine.AndroidJavaObject.FindClass (System.String name)
UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className)
UnityEngine.AndroidJavaClass..ctor (System.String className)
GoogleMobileAdsPlugin.CreateBannerView (System.String publisherId, .AdSize adSize, Boolean positionAtTop) (at Assets/Plugins/GoogleMobileAdsPlugin/GoogleMobileAdsPlugin.cs:48)
GoogleMobileAdsDemoScript.Start () (at Assets/Plugins/GoogleMobileAdsPlugin/GoogleMobileAdsDemoScript.cs:10)

I've imported the unitypackage in my project and copied the google-play-services_lib folder in the /Plugins/android folder.

I've tried several versions of the plugin but can't get it to work.
Tried on a real device, same result.

New Admob Support!?

Hi,

I've already implemented this plugin to my unity and it works well. However, I'm just wondering whether this plugin supports the new Admob or not!? Since after August 31, Google will stop the old Admob, just only the new one.

Thanks!

Banner Ads cover whole screen in white on Android (when using Ad Mediation)

When using Ad Mediation, setting a Banner Ad visible results in the entire screen being white, with the ad banner at the top (and sometimes top/left).

Everything works fine with regular Ad Mob ads.
The problem does not occur on iOS.

I'm using the Unity Plugin
I'm using MMedia as ad mediation

-------Possible fix --------
I sent MMedia a help request, and they informed me that this problem occurs when your ads do not have explicit size for the layout.

With that in mind, I believe I may have narrowed the problem to a place in com/google/unity/ads/Banner.java, where its calling:

FrameLayout.LayoutParams adParams = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);

I believe the adParams should be explicitly setting the size of the adView, but in the code, it looks like adParams just inherit size from parent (in the unity player, i suspect this would just be full-screen)

Unless I'm mistaken, this would cause the adView to take the entire screen (I can only assume that the reason this doesn't occur with regular Ad Mob ads is because they use a transparent background, while our Mediation ad-source does not)

Low framerate while using any of the ad

Hi, like suggested in this thread http://answers.unity3d.com/questions/810267/admob-highly-slowing-game-framerate.html I post the problem here.

It seems like ads are slowing my game a lot.
I created a scene only with GoogleAdDemoScript in my project, which contains other scenes.
I begin with the Demo scene and then when I press back i go back to a menu.

When I do like, creating banner/interstitial and showing them, then destroy them or not, if I go to the menu, then it is really slow.

The only thing I found which works perferctly is for banners. If I request a banner then hide it, then it is smooth everywhere.

But the thing is, I really can't use at all the ads during game otherwise it slows the framerate. The only thing I found is creating a scene especially for ads, show a banner, wait, hide it , then go back. A bit heavy... could you help please?

AdMob is not working in IOS

AdMob is successfully build in an IOS device and the game is running normally, but the admob is not working,helppppppppp!!!!!

AdMob iOS is crashing

Hi,

The plugin crashes when I initialize a BannerView on iOS.

Here's the line where the execution stops:
BannerView banner = new BannerView("MyAdMobUnitID", AdSize.SmartBanner, AdPosition.Bottom);

And this is the output from XCode:
2014-04-22 17:44:11.151 appname[13019:60b] -[GADSlot state]: unrecognized selector sent to instance 0x86a1970
2014-04-22 17:44:11.153 appname[13019:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GADSlot state]: unrecognized selector sent to instance 0x86a1970'

Any help would be appreciated

Can't find unityPackage

Hello,

I can't find the GoogleMobileAdsPlugin.unitypackage after downloading the plugin package. Where is it ?

iOS8.1 Banner ad not displaying correctly

Hi,

After updating a test device to iOS8.1 (an iPod 5th Gen) the Smart Banner ads are no longer displaying properly. They either don't show up at all, or appear as a blank grey box in the middle of the screen that is not stretched as smart banners should be. The interstitial ads continue to work normally.

The exact same version of the app continues to work fine on a different device (iPhone5) which is still running iOS7.1, with the ads always appearing when they are meant to and with the correct Smart Banner sizing.

Both screenshots are attached.
ios8_screenshot
ios7_screenshot

Button under the ad

So, I managed to integrate ads into my android game, but now i encountered another problem: I cannot click ad without clicking button behind it. And i cannot move this button because it takes almost whole screen. I tried Gui buttons, OnMouseDown, and touchposition as a button, but neither of those helped.So what can I do to end this?

Thank you

Question about using plugin on iOS

I have app running on iOS which is not released yet, and I want add this plugin to my app. Build passed without errors, but I can see only test ad (when test device is specified) unlike it was on Android. Is it normal? Or I must do some additional steps to show normal ad on iOS? Thanks.

Crash on Android 4.0.3 when preparing for InterstitialAd

Everything works well on all android devices except Android 4.0.3

The following code is crashing Unity3d application:

ad = new InterstitialAd("ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx");
AdRequest.Builder adBuilder = new AdRequest.Builder();
adBuilder.AddKeyword("game");
ad.LoadAd(adBuilder.Build());

Exception:

E/AndroidRuntime( 4175): FATAL EXCEPTION: main
E/AndroidRuntime( 4175): java.lang.Error: FATAL EXCEPTION [main]
E/AndroidRuntime( 4175): Unity version : 4.5.5f1
E/AndroidRuntime( 4175): Device model : samsung GT-P5100
E/AndroidRuntime( 4175): Device fingerprint: samsung/espresso10rfxx/espresso10rf:4.0.3/IML74K/P5100XWALD7:user/release-keys
E/AndroidRuntime( 4175):
E/AndroidRuntime( 4175): Caused by: java.lang.NoClassDefFoundError: android/os/AsyncTask
E/AndroidRuntime( 4175): at android.webkit.WebView.setupPackageListener(WebView.java:1637)
E/AndroidRuntime( 4175): at android.webkit.WebView.(WebView.java:1381)
E/AndroidRuntime( 4175): at android.webkit.WebView.(WebView.java:1342)
E/AndroidRuntime( 4175): at android.webkit.WebView.(WebView.java:1331)
E/AndroidRuntime( 4175): at android.webkit.WebView.(WebView.java:1299)
E/AndroidRuntime( 4175): at android.webkit.WebView.(WebView.java:1290)
E/AndroidRuntime( 4175): at com.google.android.gms.ads.internal.util.g.f(SourceFile:400)
E/AndroidRuntime( 4175): at com.google.android.gms.ads.internal.util.g.a(SourceFile:385)
E/AndroidRuntime( 4175): at com.google.android.gms.ads.internal.n.e.a(SourceFile:275)
E/AndroidRuntime( 4175): at com.google.android.gms.ads.internal.b.(SourceFile:290)
E/AndroidRuntime( 4175): at com.google.android.gms.ads.internal.b.(SourceFile:276)
E/AndroidRuntime( 4175): at com.google.android.gms.ads.AdManagerCreatorImpl.a(SourceFile:36)
E/AndroidRuntime( 4175): at com.google.android.gms.ads.internal.client.o.onTransact(SourceFile:66)
E/AndroidRuntime( 4175): at android.os.Binder.transact(Binder.java:297)
E/AndroidRuntime( 4175): at com.google.android.gms.internal.be$a$a.a(Unknown Source)
E/AndroidRuntime( 4175): at com.google.android.gms.internal.au.b(Unknown Source)
E/AndroidRuntime( 4175): at com.google.android.gms.internal.au.a(Unknown Source)
E/AndroidRuntime( 4175): at com.google.android.gms.internal.bi.v(Unknown Source)
E/AndroidRuntime( 4175): at com.google.android.gms.internal.bi.a(Unknown Source)
E/AndroidRuntime( 4175): at com.google.android.gms.ads.InterstitialAd.loadAd(Unknown Source)
E/AndroidRuntime( 4175): at com.google.unity.ads.Interstitial$2.run(Interstitial.java:95)
E/AndroidRuntime( 4175): at android.os.Handler.handleCallback(Handler.java:605)
E/AndroidRuntime( 4175): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 4175): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 4175): at android.app.ActivityThread.main(ActivityThread.java:4514)
E/AndroidRuntime( 4175): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 4175): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 4175): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
E/AndroidRuntime( 4175): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
E/AndroidRuntime( 4175): at dalvik.system.NativeStart.main(Native Method)

BanerView.cs error

Assets/GoogleMobileAds/Api/BannerView.cs(22,20): error CS1502: The best overloaded method match for `GoogleMobileAds.Common.IGoogleMobileAdsBannerClient.CreateBannerView(string, AdSize, GoogleMobileAds.Api.AdPosition)' has some invalid arguments

and

Assets/GoogleMobileAds/Api/BannerView.cs(22,20): error CS1503: Argument #2' cannot convertGoogleMobileAds.Api.AdSize' expression to type `AdSize'

Unity 4.3
I use last version plagin

Unable to get working

Just switched over from a 3rd party admob utility that was using the new Play Services framework for adMob and having little success here.

Trying to run the demo, with my app string, using false for testing (live on device) I get the following:

03-13 00:25:14.474: E/Ads(17834): JS: Uncaught ReferenceError: AFMA_buildAdURL is not defined (http://googleads.g.doubleclick.net/:1)

Unity3d Integration with Android fail with ClassNotFoundException

Hi,

I follow the steps on the guide, use the sample provided but with no luck and it always appear the exception as below when i build into my HTC Desire HD(Android 2.3.5).

10-02 10:49:05.681: I/Unity(12585): AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.ads.AdSize
10-02 10:49:05.681: I/Unity(12585): at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in :0
10-02 10:49:05.681: I/Unity(12585): at UnityEngine.AndroidJNISafe.CallStaticObjectMethod (IntPtr clazz, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in :0
10-02 10:49:05.681: I/Unity(12585): at UnityEngine.AndroidJavaObject._CallStatic[AndroidJavaObject](System.String methodName, System.Object[] args) [0x00000] in :0
10-02 10:49:05.681: I/Unity(12585): at UnityEngine.AndroidJavaObject.CallStatic[AndroidJavaObject](System.String methodName, System.Object[] args) [0x00000] in :0
10-02 10:49:05.681: I/Unity(12585): at UnityEngine.AndroidJavaObject.FindClass (System.String name) [0x00000] in :0
10-02 10:49:05.681: I/Unity(12585): at UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) [0x00000] in :0
10-02 10:49:05.681: I/Unity(12585): at UnityEngine.AndroidJavaClass..ctor (System.String className) [0x00000] in :0
10-02 10:49:05.681: I/Unity(12585): at GoogleMobileAds.Android.Utils.GetAdSizeJavaObject (GoogleMobileAds.Api.AdSize ad

had tested the free or not free version by using a trial version of Unity3d Pro and found that It actually didn't change the situation.

In fact I had done some testing as use my previous version of Google Play service with version 4242000 and current version which is 5089000.

  • When I try to call new JavaAndroidClass function for "com.google.android.gms.ads.AdSize" in Unity3d, the Google Play Version 4242000 actually did return a class for me in stead of throwing exception while in the Google Play Version 5089000.

This indeed is where the problem located but i have no access to the google code and also all other stuff to proceed further. This is a pain and if anyone found a solution I'll be very happy to be informed.

Event callback when ad is clicked?

It'd be great if your game could tell (either through an event or some such wizardry) whether or not an ad has been clicked. For example, I give the player the option of waiting five minutes to proceed in the game or to click an ad and proceed immediately. Or, reward 50 energy points for clicking a banner, that sort of thing.

Art not supported

I wanted to write this as a comment on issue #1 but github won't let me.
I have done a bunch of testing on my own devices and have found that any device running ART will force close when trying to display the ad. I am not positive as to why this is, there are other apps on my devices that use google ads with no problem.
According to the Logcat the ad is successfully loaded, but when it is sent back to unity there is a null array exception thrown. It doesn't call any of the error callbacks it just dies in a fire.

Events not called from the Main Thread

Hi

Admob event delegates are not called from the Main Thread, and I can't pause / unpause my game when using them.

Is there any particular way needed to be used, in order to make delegate methods (AdClosed etc) be run on Main Thread?

Hide/Destroy/Show Functions doesn't work. What Do i need to do?

Hello everyone,

As you see in the title of the issue, i have problem on call functions. I call these functions but they don't work on iOS. At the beginning of the game banner comes to screen very good. I want to destroy this banner after i hit play button. But banner doesn't destroy. Is there any problem on this plugin?

Landscape Interstitial Ads

I've implemented the plugin and everything is working fine, the only one problem that the interstitial ad doesn't show in landscape mode with the exact orientation of the device, does it is working with orientation? Or, please tell me what can I do to fix it, what file should I modify to fix the orientation? Great plugin, see ya.

TopRight

Please add the AdPosition.TopRight / AdPosition.TopLeft Some of my games are designed around having the banner in those positions, and now that I can't submit any more games with the previous version of AdMob as of August 1st I really need this option.

Thanks

Can't compile project.

Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
C:\Program Files (x86)\Java\jdk1.7.0_09\bin\java.exe -Xmx1024M -Dcom.android.sdkmanager.toolsdir="D:/Papa/Android/android-sdk\tools" -Dfile.encoding=UTF8 -jar "C:/Program Files (x86)/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -

stderr[

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/ko;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
....
....
....

Admob not working for iOS

I am trying to create interstitial ads in unity for iOS platform. I have followed coding sample provided in GoogleMobileAdsDemoScript file, but unfortunately ads are not produced. I just see a message on console:

To get test ads on this device, call: request.testDevices = @[@"b9ade3b76dd9d16ccc6c61b78bf7d427"];

I have used following code in unity:

        private void RequestInterstitial()
      {
    print ("Requesting AD");

    #if UNITY_EDITOR
    string adUnitId = "unused";
    #elif UNITY_ANDROID
    string adUnitId = "INSERT_ANDROID_INTERSTITIAL_AD_UNIT_ID_HERE";
    #elif UNITY_IPHONE
    string adUnitId = "ca-app-pub-3113890509031570/1543899246";
    #else
    string adUnitId = "unexpected_platform";
    #endif

    // Create an interstitial.
    interstitial = new InterstitialAd(adUnitId);
    // Register for ad events.
    interstitial.AdLoaded += HandleInterstitialLoaded;
    interstitial.AdFailedToLoad += HandleInterstitialFailedToLoad;
    interstitial.AdOpened += HandleInterstitialOpened;
    interstitial.AdClosing += HandleInterstitialClosing;
    interstitial.AdClosed += HandleInterstitialClosed;
    interstitial.AdLeftApplication += HandleInterstitialLeftApplication;
    // Load an interstitial ad.
    interstitial.LoadAd(createAdRequest());
}

// Returns an ad request with custom ad targeting.
private AdRequest createAdRequest()
{
    return new AdRequest.Builder ()
        .AddTestDevice(AdRequest.TestDeviceSimulator)
        .AddTestDevice("my device ID")
            .AddKeyword("game")
            .AddExtra("color_bg", "454545")
            .Build();

}

#region Interstitial callback handlers

public void HandleInterstitialLoaded(object sender, EventArgs args)
{
    print("HandleInterstitialLoaded event received.");
    interstitial.Show();
}

public void HandleInterstitialFailedToLoad(object sender, AdFailedToLoadEventArgs args)
{
    print("*********** HandleInterstitialFailedToLoad event received with message: " + args.Message);
}

public void HandleInterstitialOpened(object sender, EventArgs args)
{
    print("HandleInterstitialOpened event received");
}

void HandleInterstitialClosing(object sender, EventArgs args)
{
    print("HandleInterstitialClosing event received");
}

public void HandleInterstitialClosed(object sender, EventArgs args)
{
    print("HandleInterstitialClosed event received");
}

public void HandleInterstitialLeftApplication(object sender, EventArgs args)
{
    print("HandleInterstitialLeftApplication event received");
}

#endregion

Please help me in resolving this issue. Thanks.

Crash on Android when built using Unity 4.6

Everytime I called BannerView.LoadAd() the app is force closed. It worked fine last time when I'm still using Unity 4.5, but since I updated using Unity 4.6 build 21, I get this issue. The logcat prints this error:
admobcrash

The interstitial ads has an issue as well:
interscrash

This issue only happens in android devices, it works fine on iOS.
Is there any workaround to fix this problem?

iOS 8 Support?

AdMob version 6.12.0 has fixed some critical issues on iOS 8 (namely landscape banner ads). However, the API has been changed enough that the current version of this Unity plug-in no longer works. I am getting multiple linker errors due to trying to use non-existent API calls.

I need to release an update to my game ASAP to fix this and a few other iOS 8-specific issues.

When can we expect an update to this plug-in to support AdMob 6.12.0 and iOS 8?

bannerView.Hide() & bannerView.Show() Not Working

Hi,

The methods bannerView.Hide() & bannerView.Show() are not working, the banner ad is always shown even when I call bannerView.Hide().

This is the class I'm using:

using UnityEngine;
using System.Collections;
using GoogleMobileAds.Api;

public class AdMobController : MonoBehaviour {

BannerView bannerView;

void Start () {
    // Create a 320x50 banner at the top of the screen.
    bannerView = new BannerView("ca-app-pub-xxxxx/xxxxxx", AdSize.Banner, AdPosition.Top);
    // Create an empty ad request.
    AdRequest request = new AdRequest.Builder()
                          .AddTestDevice(AdRequest.TestDeviceSimulator)       // Simulator
                          .Build();
    // Load the banner with the request.
    bannerView.LoadAd(request);
}

void Update() {
    if (Application.loadedLevelName == "Main") {
        bannerView.Hide();
    }
    else {
        bannerView.Show();
    }
}

}

Any ideas??

closing interstitial crashes app on iOS

A tester using an iPad Air is reporting that the app crashes every time he closes an interstitial advert. I don't have an iOS device to test myself at the moment, but everything is working OK for Android.

Anyone had this problem? Any ideas?

Thanks

How can I close the test mode

Like what I say, I build it to my iPhone and it can only be used with test mode, how can I close it and publish the app to app store

BannerView.cs error

Assets/GoogleMobileAds/Api/BannerView.cs(22,20): error CS1502: The best overloaded method match for `GoogleMobileAds.Common.IGoogleMobileAdsBannerClient.CreateBannerView(string, AdSize, GoogleMobileAds.Api.AdPosition)' has some invalid arguments

Assets/GoogleMobileAds/Api/BannerView.cs(22,20): error CS1503: Argument #2' cannot convertGoogleMobileAds.Api.AdSize' expression to type `AdSize'

I have no idea how to fix it

Google Play Games Plugin plus Ads

So I'm currently using BFS Google Play games plugin (which sadly doesn't seem to have support anymore) and this Ad plugin.
For some reason, when I add the unity-plugin-library. jar file, my app will crash on launch. However, if I don't have it, the ads will not work.
It seems like there was a problem with the google-play-services.jar from the BFSGPG plugin not being the full jar file (missing the ad folders), but when I replaced them, the app would still crash on launch.

I can't really abandon the BFS plugin or else I would...

Missing Positionings

There are only Top and Bottom positions

Missing positions:

  • TopRight, TopLeft, BottomLeft, BottomRight

Regards and thanks for good work

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.