googleads / googleads-mobile-android-mediation

Sample Android project showcasing how to build a mediation adapter or custom event for the Google Mobile Ads SDK.
Apache License 2.0
245 stars 199 forks source link

Callbacks Not Being Called With UnityAds #11

Closed gayoso closed 7 years ago

gayoso commented 7 years ago

Hi! I believe I have set up AdMob mediation correctly, as I am getting both Interstitials and Rewarded Videos from AdMob and UnityAds. When I get an ad from AdMob, everything works great and all callbacks are called. The log looks like this ("interstitial ad opening", "ad was closed" are used for logging in their respective callbacks):

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)

When I get an ad from UnityAds, only the "opening" callback is called. This is what the log looks like:

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}

Did I set up something the wrong way? I am using testing mode in both UnityAds and AdMob right now. I guess the most important question is if this happens only in testing, or if it will continue after publishing the app.

Thanks!

thoechsmann commented 7 years ago

We have the same problem. Happens also on production build.

sbagadi commented 7 years ago

I was not able to reproduce the issue using using our sample app.

I am using

I am seeing all the callbacks from Unity Adapter. Please see the logcat output from my testing below.

07-13 08:56:51.967 3315 4069 D Ads : Received ad response. 07-13 08:56:51.983 3315 4069 D Ads : AdRenderer: com.google.android.gms.ads.internal.reward.mediation.i 07-13 08:56:51.983 3315 3998 D Ads : Check if adapter is initialized. 07-13 08:56:51.983 3315 3997 D Ads : Check if adapter is initialized. 07-13 08:56:51.983 3315 3315 D Ads : Requesting rewarded video ad from adapter. 07-13 08:56:51.984 3315 3315 W Ads : Server parameters: {"pubid":"ca-app-pub-7245804383510725\/2691078899\/cak=no_cache&cadc=jb&caqid=P5hnWauzNZPWBvDxjtAP","gwhirl_share_location":"1"} 07-13 08:56:51.996 3315 3315 I Ads : Starting ad request. 07-13 08:56:51.996 3315 3315 I Ads : Use AdRequest.Builder.addTestDevice("3C8EBD0CFE2896A69A5CD89835508540") to get test ads on this device. 07-13 08:56:52.002 3315 4023 D Ads : AdLoaderBackgroundTask started. 07-13 08:56:52.002 3315 3315 D Ads : Requesting rewarded video ad from adapter. 07-13 08:56:52.002 3315 3315 W Ads : Server parameters: {"zoneId":"rewardedVideo","gwhirl_share_location":"1","gameId":"1031512"} 07-13 08:56:52.003 3315 3315 D Ads : Adapter called onAdLoaded. 07-13 08:56:52.007 3315 3315 I Ads : Ad finished loading. 07-13 08:56:52.028 3315 4023 D Ads : Received ad response. 07-13 08:56:52.041 3315 3315 I Unity : HandleRewardBasedVideoLoaded event received 07-13 08:56:52.041 3315 3315 I Unity :
07-13 08:56:52.041 3315 3315 I Unity : (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37) 07-13 08:56:52.041 3315 3315 I Unity : 07-13 08:56:52.041 3315 3315 D Ads : Disable the debug gesture detector on the mediation ad frame. 07-13 08:56:52.042 3315 3315 D Ads : Pinging network fill URLs. 07-13 08:56:52.044 3315 4032 D Ads : Pinging URL: https://googleads.g.doubleclick.net/pagead/conversion/?ai=ChRLEP5hnWYqhNsqjBfGGndgP-cnapgXR74W6kgEAEAgg_LeEKGDJ7u2GgICgGYgBAakCAAAAAICELkGoAwGqBCBP0JaiR1c2cl4t77kfPALg9o_iZEByn7cCx_8u-rKVgpAGAcAGC4AHgfipMJgHAdIIBQiAARAB&sigh=JHP6INPDauw&label=admob_mediation_request_fill_result&mediation_fill_status=9955636539472406.0.20&cid=CAASEuRoI02dQyM68D12mzBM4nI2DQ 07-13 08:56:52.060 3315 3315 D Ads : Enabling hardware acceleration on an overlay. 07-13 08:56:52.064 3315 3315 D Ads : AdRenderer: com.google.android.gms.ads.internal.renderer.i 07-13 08:56:52.064 3315 3315 D Ads : Loading HTML in WebView. 07-13 08:56:55.443 3315 3315 I Unity : onConfigurationChanged 07-13 08:56:55.491 3315 3315 D Unity : [EGL] Attaching window :0xd9721508 07-13 08:56:55.504 3315 3342 D Unity : ANativeWindow: (1080/1920) RequestedResolution: (0/0) EGLSurface: (1080/1920) 07-13 08:56:55.516 3315 3342 D Unity : Requested framebuffer: resolution[1080x1920], rgba[8/8/8/8], depth+stencil[on], samples[1] 07-13 08:56:55.516 3315 3342 D Unity : Created framebuffer: resolution[1080x1920], rgba[8/8/8/8], depth+stencil[24/8], samples[0] 07-13 08:56:56.375 3315 3315 D Ads : Show rewarded video ad from adapter. 07-13 08:56:56.375 3315 3315 D Ads : Adapter called onAdOpened. 07-13 08:56:56.375 3315 3315 D Ads : Pinging Impression URLs. 07-13 08:56:56.377 3315 3315 I Ads : Ad opening. 07-13 08:56:56.377 3315 4029 D Ads : Pinging URL: https://pagead2.googleadservices.com/pagead/adview?ai=ChRLEP5hnWYqhNsqjBfGGndgP-cnapgXR74W6kgEAEAgg_LeEKGDJ7u2GgICgGYgBAakCAAAAAICELkGoAwGqBCBP0JaiR1c2cl4t77kfPALg9o_iZEByn7cCx_8u-rKVgpAGAcAGC4AHgfipMJgHAdIIBQiAARAB&sigh=MGZ67zPKBS8&cid=CAASEuRoI02dQyM68D12mzBM4nI2DQ&gvr=1 07-13 08:56:56.400 3315 3315 I Unity : HandleRewardBasedVideoOpened event received 07-13 08:56:56.400 3315 3315 I Unity :
07-13 08:56:56.400 3315 3315 I Unity : (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37) 07-13 08:56:56.400 3315 3315 I Unity : 07-13 08:56:57.831 3315 3315 I Unity : onPause 07-13 08:56:57.846 3315 3342 D Unity : Sensor : Accelerometer ( 1) ; 0.002394 / 0.00s ; BMI160 accelerometer / Bosch 07-13 08:56:57.853 3315 3315 I Unity : windowFocusChanged: false 07-13 08:56:57.864 3315 3315 D Ads : App is still foreground. 07-13 08:56:57.990 3315 3315 D Unity : [EGL] Attaching window :0x0 07-13 08:56:58.581 3315 3315 D Ads : Adapter called onVideoStarted. 07-13 08:56:58.583 3315 4031 D Ads : Pinging URL: https://googleads.g.doubleclick.net/pagead/conversion/?ai=ChRLEP5hnWYqhNsqjBfGGndgP-cnapgXR74W6kgEAEAgg_LeEKGDJ7u2GgICgGYgBAakCAAAAAICELkGoAwGqBCBP0JaiR1c2cl4t77kfPALg9o_iZEByn7cCx_8u-rKVgpAGAcAGC4AHgfipMJgHAdIIBQiAARAB&sigh=JHP6INPDauw&label=admob_mediation_reward_video_start&cid=CAASEuRoI02dQyM68D12mzBM4nI2DQ 07-13 08:56:58.606 3315 3315 I Unity : HandleRewardBasedVideoStarted event received 07-13 08:56:58.606 3315 3315 I Unity :
07-13 08:56:58.606 3315 3315 I Unity : (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37) 07-13 08:56:58.606 3315 3315 I Unity : 07-13 08:57:07.956 3315 3315 D Ads : Adapter called onAdClosed. 07-13 08:57:07.957 3315 3315 I Ads : Ad closing. 07-13 08:57:07.979 3315 3315 I Unity : HandleRewardBasedVideoClosed event received 07-13 08:57:07.979 3315 3315 I Unity :
07-13 08:57:07.979 3315 3315 I Unity : (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37) 07-13 08:57:07.979 3315 3315 I Unity : 07-13 08:57:08.045 3315 3315 D Ads : App is still foreground. 07-13 08:57:08.045 3315 3315 I Unity : onResume

Could you please send a sample app that can reproduce this issue?

Thanks, Santosh

ericleich commented 7 years ago

Closing this issue due to it not being reproducible.

rsodre commented 7 years ago

I also experience that issue, Unity Ads rewarded videos does not call OnAdRewarded and OnAdClosed. Since @sbagadi setup is not really up to date (nobody uses Unity 5.3 anymore, and who'll install AdMob 3.4 when we're in 3.7?), I request to reopen and try with the current releases. I have a sample project with the problem isolated if anyone on the team want to take a look.

Here's my setup, with the versions I had when first noticed the problem and the version that I'm currently using....

Unity 3D 5.6.2 - 5.6.3 (Plus, OSX) Unity Ads SDK 2.1.0 - 2.1.1 Unity Ads Adapter 2.1.0 - 2.1.1 Google Mobile Ads Unity Plugin 3.6.3 - 3.7.1 (also tried 3.4.0) Play services 11.2.2 - 11.4.0 Jar Resolver 1.2.48 - 1.2.52

rsodre commented 7 years ago

Nevermind, fixed that problem by not calling Advertisement.Initialize(appId); AdMob already Initializes Unity Ads, calling it twice will break it.