Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice
  2. We've opened up a space to discuss, share feedback, and showcase everything related to the Unity Shader Graph! Come show us what you've made.
    Dismiss Notice

Unity Ads not working with AdMob Mediation

Discussion in 'Unity Ads' started by gayoso, Jul 3, 2017.

  1. gayoso

    gayoso

    Joined:
    Mar 17, 2016
    Posts:
    1
    Hi! I have setup AdMob Mediation and I am successfully getting both interstitial and rewarded video ads from both UnityAds and AdMob in my app (both networks in testing mode, no revenue yet). However, it seems that the callbacks I register are not called when I get an ad from UnityAds, but they work fine when I get an ad from AdMob.
    Here is the logcat output for an ad from AdMob:

    07-02 14:09:38.701 27937 27937 I Unity :
    07-02 14:09:44.612 4691 30635 I ActivityManager: START u0 {cmp=com.Cockbear.Cuboid/com.google.android.gms.ads.AdActivity (has extras)} from uid 10208 on display 0
    07-02 14:09:44.779 27937 27937 I Unity : interstitial ad opening
    07-02 14:09:44.779 27937 27937 I Unity :
    07-02 14:09:44.779 27937 27937 I Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
    07-02 14:09:44.779 27937 27937 I Unity :
    07-02 14:09:45.093 4691 4728 I ActivityManager: Displayed com.Cockbear.Cuboid/com.google.android.gms.ads.AdActivity: +438ms
    07-02 14:09:45.103 4691 2996 I ActivityManager: Process android.process.media (pid 27566) has died
    07-02 14:09:45.103 4691 2996 D ActivityManager: cleanUpApplicationRecord -- 27566
    07-02 14:09:49.438 4691 7518 W ActivityManager: Duplicate finish request for ActivityRecord{e8c4e53 u0 com.Cockbear.Cuboid/com.google.android.gms.ads.AdActivity t747 f}
    07-02 14:09:49.531 27937 27937 I Unity : Ad was closed
    07-02 14:09:49.531 27937 27937 I Unity :
    07-02 14:09:49.531 27937 27937 I Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

    And here is the output for an ad from UnityAds:

    07-02 14:09:50.776 27937 27937 I Unity :
    07-02 14:10:20.240 27937 27937 I Unity : interstitial ad opening
    07-02 14:10:20.240 27937 27937 I Unity :
    07-02 14:10:20.240 27937 27937 I Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
    07-02 14:10:20.240 27937 27937 I Unity :
    07-02 14:10:20.435 4691 6804 I ActivityManager: START u0 {flg=0x10010000 cmp=com.Cockbear.Cuboid/com.unity3d.ads.adunit.AdUnitActivity (has extras)} from uid 10208 on display 0
    07-02 14:10:20.503 4691 17281 I ActivityManager: Config changes=480 {1.0 722mcc310mnc [en_US,es_AR] ldltr sw411dp w411dp h659dp 420dpi nrml port finger -keyb/v/h -nav/h s.644}
    07-02 14:10:20.900 4691 4728 I ActivityManager: Displayed com.Cockbear.Cuboid/com.unity3d.ads.adunit.AdUnitActivity: +426ms
    07-02 14:10:21.402 4691 4728 I ActivityManager: Config changes=480 {1.0 722mcc310mnc [en_US,es_AR] ldltr sw411dp w683dp h387dp 420dpi nrml land finger -keyb/v/h -nav/h s.645}

    These are from an interstitial, but for rewarded video I also get a successfull call to the "onReward" method with the AdMob ads, but not with the UnityAds ones.

    I know this question seems more logical in the AdMob Mediation github repo, but I have already asked there and I wanted to know if anyone here as come across this problem before. Most of all, I'm hoping this happens only because of the difference in how UnityAds and AdMob work when in development mode and it won't happen once I release the app. I read somewhere that AdMob creates real ad requests but provides no revenue (which is why I get ads for real games with AdMob) while UnityAds seem to provide "dummy" or test ads.

    From the logcats I can also notice that when I get an ad from UnityAds there is an activity started called "com.unity3d.ads.adunit.AdUnitActivity", and with AdMob ads it's "com.google.android.gms.ads.AdActivity". But I don't know enough to tell wether this is normal behaviour or not.

    Thanks!
     
  2. thomas231

    thomas231

    Joined:
    Aug 18, 2016
    Posts:
    4
    We have the same problem and it forces us to disable all Unity ads until we find a solution.
     
  3. wuym67123

    wuym67123

    Joined:
    Jan 3, 2017
    Posts:
    11
    You can try the admob unity ads plugin ,witch integrates admob and unity ads.
    I have success display video ads both admob and unity ads.
     
  4. rahat090255

    rahat090255

    Joined:
    Aug 15, 2018
    Posts:
    10
    I tired this but not working. Facebook is working fine but not unity
     
  5. DiegoR

    DiegoR

    Joined:
    Oct 31, 2012
    Posts:
    27
    Still have the same problem.

    If I use UnityAds directly works perfect. But when AdMob uses UnityAds though the mediation, the callbacks are not called and the app doesn't know when the ad was closed.

    I followed the integration instructions from Google AdMob, imported the package GoogleMobileAdsUnityAdsMediation.unitypackage and so on.
     
    mustafacan likes this.
  6. Jonathan-FourFats

    Jonathan-FourFats

    Joined:
    Apr 21, 2016
    Posts:
    15
    same issue here, can't enable unity ads until they fix this, admob have better ecpm anyway
     
    mustafacan likes this.
  7. plusgamesgulcanyazir

    plusgamesgulcanyazir

    Joined:
    Feb 12, 2019
    Posts:
    6
    I have the same problem. Is there a solution to this? Please, advise...
     
    mustafacan likes this.
  8. plusgamesgulcanyazir

    plusgamesgulcanyazir

    Joined:
    Feb 12, 2019
    Posts:
    6
    I solved my problem. For those who have a similar problem. Here is my setup, problem & solution. It might help you solve yours.

    SETUP:
    I imported Easy Mobile plugin into my project. I use Admob + Unity Ads(through Admob mediation). The plugin gives me the chance to use Unity Ads directly. However; I prefer to use Unity Ads through Admob mediation for better flexibility and on-the-fly changes. Thus, I disabled all Unity Ads related stuff from services menu, even removed Unity Ads from package manager, also did not import Monetization plugin from the Asset Store. I only imported Google Mobile Ads plugin and Unity adapter for Google Mobile Ads following the guidelines on Admob page.(Adapter imports com.unity3d.ads.unity-ads-#.#.#.aar itself because it is a dependency)

    PROBLEM:
    • Banner ads served by Admob work as expected. Did not test callbacks.Not needed in my case.
    • Intersitial ads served by Admob and Unity Ads work as expected. Did not test callbacks.Not needed in my case.
    • Rewarded ads served by Admob work as expected. Tested callbacks, they are needed in my project and they work as expected.
    • Rewarded ads served by Unity Ads through Admob mediation loads&show as expected. Tested callbacks, however they don't work as expected. "RewardedAdCompleted" callback never fire at first ad request and is inconsistent with the following requests. This is a big problem for my game as I give free coins as a reward.
    In deeper investigation, I realized that the problem was with the way "RewardedAdCompleted" & "RewardedAdSkipped" callbacks work in the Easy Mobile plugin. They first check "Google Mobile Ads's OnAdRewarded" callback, switch a bool flag accordingly and decide if rewarded video is skipped or watched till the end within the "Google Mobile Ads's OnAdClosed" callback. For this to work properly, OnAdRewarded should always be called before OnAdClosed. However, it does not; at least for Unity Ads's rewarded videos called through mediation.

    SOLUTION: Delay what happens in "OnAdClosed" at least one frame so that "OnAdRewarded" can set the bool flag properly and in time. I did this with a simple Coroutine and the problem is solved. All rewarded video callbacks for both Admob and Unity ads works as expected now.

    SUMMARY: If you have a problem with your rewarded video callbacks, the problem is probably with your code or within a plugin you import & the way it manages callbacks. Not with Admob, Unity Ads or their plugins.

    If this post is of any help to you, you are welcome :)