googleads / googleads-mobile-unity

Official Unity Plugin for the Google Mobile Ads SDK
https://developers.google.com/admob/unity
Apache License 2.0
1.37k stars 1.08k forks source link

OnPaidEvent not invoked on Android (Huawei P40) for RewardedAd #1726

Closed SavaMinic closed 1 year ago

SavaMinic commented 3 years ago

Describe your environment

Describe the problem

RewardAd class has a OnPaidEvent EventHandler, where documentation says "Called when an ad is estimated to have earned money." For iOS builds, it works fine and reports immediately after the video is watched. For Android Samsung S6, it works fine and reports immediately after the video is watched. For Android Huawei P40, this callback is never invoked.

Steps to reproduce:

Expected behavior:

OnPaidEvent should be called and debug line should be shown

Result behaviour:

OnPaidEvent is not called

Relevant Code:

public void RequestAndLoadRewardedAd()
{
    var rewardedAd = new RewardedAd("YOUR_PRODUCTION_AD_UNIT_ID");
    rewardedAd.OnPaidEvent += (sender, args) => Debug.LogError("OnPaidEvent");
    rewardedAd.LoadAd(CreateAdRequest());
}
NVentimiglia commented 3 years ago

I was able to get ahold of a Huawei P40. Testing on HelloWorld, I was unable to replicate the issue.

What Mediator plugins are you using?

SavaMinic commented 3 years ago

There are no mediation plugins, literally just the HelloWorld with production app id, admob id and ad-unit id, and some debug logs.

I opened logs on both phones, and on the Huawei P40 (which is not invoking OnPaidEvent), it has this weird error after loading ad.

08-06 09:33:16.447 31519 31519 W Ads : #007 Could not call remote method. @28 08-06 09:33:16.447 31519 31519 W Ads : java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String com.google.android.gms.internal.ads.zzdse.getVersion()' on a null object reference 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzard.getVersion(com.google.android.gms:play-services-ads-lite@@19.5.0:32) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzdds.zzasx(com.google.android.gms:play-services-ads@@19.5.0:10) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzddv.call(Unknown Source:2) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzdzq.zzazk(com.google.android.gms:play-services-ads@@19.5.0:5) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzdyy.run(com.google.android.gms:play-services-ads@@19.5.0:8) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzdzo.run(com.google.android.gms:play-services-ads@@19.5.0:11) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzazk.execute(com.google.android.gms:play-services-ads@@19.5.0:4) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzazn.execute(com.google.android.gms:play-services-ads@@19.5.0:4) 08-06 09:33:16.447 31519 31519 W Ads : at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzdxr.zze(com.google.android.gms:play-services-ads@@19.5.0:5) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzdds.zzasm(com.google.android.gms:play-services-ads@@19.5.0:6) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzdfl.zzt(com.google.android.gms:play-services-ads@@19.5.0:7) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzbqz.zzakq(com.google.android.gms:play-services-ads@@19.5.0:13) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzbqz.zzakr(com.google.android.gms:play-services-ads@@19.5.0:14) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzboz.zzaki(com.google.android.gms:play-services-ads@@19.5.0:39) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzboz.zzakj(com.google.android.gms:play-services-ads@@19.5.0:59) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzdkd.zza(com.google.android.gms:play-services-ads@@19.5.0:5) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzdma.zza(com.google.android.gms:play-services-ads@@19.5.0:32) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzdmi.zza(com.google.android.gms:play-services-ads@@19.5.0:72) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzdmi.zza(com.google.android.gms:play-services-ads@@19.5.0:8) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.internal.ads.zzavs.zza(com.google.android.gms:play-services-ads-lite@@19.5.0:9) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.android.gms.ads.rewarded.RewardedAd.loadAd(com.google.android.gms:play-services-ads-lite@@19.5.0:6) 08-06 09:33:16.447 31519 31519 W Ads : at com.google.unity.ads.UnityRewardedAd$2.run(UnityRewardedAd.java:88) 08-06 09:33:16.447 31519 31519 W Ads : at android.os.Handler.handleCallback(Handler.java:900) 08-06 09:33:16.447 31519 31519 W Ads : at android.os.Handler.dispatchMessage(Handler.java:103) 08-06 09:33:16.447 31519 31519 W Ads : at android.os.Looper.loop(Looper.java:219) 08-06 09:33:16.447 31519 31519 W Ads : at android.app.ActivityThread.main(ActivityThread.java:8387) 08-06 09:33:16.447 31519 31519 W Ads : at java.lang.reflect.Method.invoke(Native Method) 08-06 09:33:16.447 31519 31519 W Ads : at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) 08-06 09:33:16.447 31519 31519 W Ads : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)

Error don't appear on other Android phones, and OnPaidEvent works on them. Is it maybe something with the fact that Huawei doesn't have Google Mobile Services (GMS)/Google Apps?

KrKgg commented 3 years ago

@SavaMinic Do you receive incoming data from another device? I tried using this method but it didn't get anything, it's like not calling the function OnPaidEvent.

SavaMinic commented 3 years ago

@KrKgg It worked for all iPhone devices and some Android devices (e.g Samsung S6).

KrKgg commented 3 years ago

@SavaMinic I have tried many times, it only invoked when testing on test ads, when real ads are not invoked.

bolds07 commented 3 years ago

I had the same doubt

onPaidEvent doesn't fire in real devices in produtction, you will only get this event in TEST DEVICES or in the android emulator.

I got this information from the admob engineer https://groups.google.com/g/google-admob-ads-sdk/c/jDCGj5r-JyA/m/_DBN_WQ6AAAJ

Mecze commented 2 years ago

We are suffering the same problem. OnPaidEvent (which came to substitute OnAdLeavingApp) does not work on production by any means. Also, on Testing devices it is launched when the Ad Opens (Banner OnPaidEvent is launched when the banner is shown, not clicked, same with interstitial) We are unable to know if a user clicked on an ad or not, which goes against any kind of metric we have to extract from our app, or avoiding other ads in order to avoid overflooding our users with ads (User clicks banner > user leaves app > User comes back > user Gets interstitial. Not a great user experience, because we cannot know when the user clicked the banner) Yes OnAdLeavingApp was not exact or reliable, but it was something. Please, fix this ASAP we need to know who clicks on ads on our app, client side. Or tell us if there's a workaround this.

russellsimpkins commented 2 years ago

You shouldn't use that callback to learn if the rewarded video is closing. Instead use https://developers.google.com/admob/android/rewarded#set_the_fullscreencontentcallback.

Mecze commented 2 years ago

You shouldn't use that callback to learn if the rewarded video is closing. Instead use https://developers.google.com/admob/android/rewarded#set_the_fullscreencontentcallback.

From what I gathered reading other responses on this thread no body is doing that. We are not expecting to know if the ad closes, we have another callback for that. We want the event to fire, since some of us had logic on the old OnAdLeavingApp before upgrading Admob.

Since my last response we discovered how to fire it in production. You need to be whitelisted for that. Talk your closer Admob rep.

I Take the opportunity to remember Admob devs and the community about the biggest hurdle in Admob 6.0+: The Admob ANR fiesta (More here). Please fix this!

kunny commented 1 year ago

Since there were no recent activities for this issue, we are therefore reluctantly going to close this bug for now.

If you are still experiencing the problem, please file a new issue with the same description, what happens and system / network tracing / Charles logs.

All system setups can be slightly different, so it's always better to open new issues and reference the related ones. Thanks for your contribution.