Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OnUserEarnedReward is called after OnAdClosed in Android Device #1689

Closed
desouse opened this issue Jul 7, 2021 · 13 comments
Closed

OnUserEarnedReward is called after OnAdClosed in Android Device #1689

desouse opened this issue Jul 7, 2021 · 13 comments
Assignees

Comments

@desouse
Copy link

desouse commented Jul 7, 2021

Step 0: Are you in the right place?

  • For general technical questions, or help with project-specific issues like setting up ads in
    your app, reach out to our support team on the
    Developer Forum.
  • For assistance with your AdMob account, reach out to
    AdMob Support.
  • For feedback on our documentation,
    send your feedback by pressing the Send Feedback button at the top right of the
    documentation page you are on.
  • For issues related to the code in this repository, continue filing this GitHub issue.

[REQUIRED] Step 1: Describe your environment

  • Unity version: 2018.4.17f1
  • Target API 30
  • Google Mobile Ads Unity plugin version: 6.0.1
  • Platform: Android
  • Platform OS version: tested on 8.1 and 11
  • Any specific devices issue occurs on: _____
  • Mediation ad networks used, and their versions: AppLovinUnityAdapter-5.0.0, FacebookUnityAdapter-3.3.0, UnityAdsUnityAdapter-2.7.0, VungleUnityAdapter-3.6.0

[REQUIRED] Step 2: Describe the problem

Steps to reproduce:

OnUserEarnedReward event is called after OnAdClosed in Android device.
For test purposes, it was used HelloWorld example project with mediation ad networks described above, and with real adUnitId(https://github.com/googleads/googleads-mobile-unity/tree/master/samples/HelloWorld)

Screenshot with the log:

AppLovinBug

The last message after closing the ad was User Earned Reward instead of Ad Closed
image

@ericleich
Copy link
Member

The callback order is dependent on the adapter implementations, and typically the limiting factor is we rely on the events from the 3p SDK to then forward onto you. In this case, you're using AppLovin -- it's possible their SDK returns ad closed callback before the ad reward callback, in which case there's not much we can do about it. Holding the call to onAdClosed() until the rewarded callback is invoked is risky, because we don't know that the reward callback will happen 100% of the time.

@joshuajplagonera to dig into the AppLovin Android adapter and confirm the behavior.

@Archi97
Copy link

Archi97 commented Jul 8, 2021

@ericleich why no one of your team is answering to my question? What is the problem.
There is strange things on Last SKD version. but no on from your team interested in it
#1690 #1677 #1661

@ericleich
Copy link
Member

@Archi97 the other 3 should all be commented now.

@joshuajplagonera
Copy link
Collaborator

Hi All,

We currently forward onAdClosed() and onUserEarnedReward() on the same callback on the AppLovin Android adapter: https://github.com/googleads/googleads-mobile-android-mediation/blob/master/ThirdPartyAdapters/applovin/applovin/src/main/java/com/applovin/mediation/AppLovinIncentivizedAdListener.java#L49
It is possible that this is caused by the Unity plugin.

@ericleich
Copy link
Member

@NVentimiglia to take a look. The Unity plugin does do some threading/queueing with events that come back, and the logs above do make it seem like the plugin is mishandling a race condition.

@Last8Exile
Copy link

Last8Exile commented Jul 20, 2021

Callback order wery poorly described.

I use async (task or coroutine) to handle callbacks. After i receive onAdClosed i wait several frames for onUserEarnedReward and if it not happend - consider it as skipped (canceled) ad

@NVentimiglia
Copy link
Member

NVentimiglia commented Aug 5, 2021

I took a look at this issue and was unable to replicate on my first pass. Here are my steps.

  • Default Hello world sample with 6.0.2 and AppLovin 5.1.0
  • Modified keys to look at AppLovin
  • Added debug statements to Reward Interstitial events
  • Tested Reward Interstitial on Android
  • Result was that the reward event came before the close event

Is there something I missed ?

@desouse
Copy link
Author

desouse commented Aug 5, 2021

I took a look at this issue and was unable to replicate on my first pass. Here are my steps.

  • Default Hello world sample with 6.0.2 and AppLovin 5.1.0
  • Modified keys to look at AppLovin
  • Added debug statements to Reward Interstitial events
  • Tested Reward Interstitial on Android
  • Result was that the reward event came before the close event

Is there something I missed ?

Hello. The only difference here - it was used Rewarded Ad instead of Rewarded Interstitial Ad.

@desouse
Copy link
Author

desouse commented Aug 5, 2021

I have just also tried UnityAdsUnityAdapter-2.7.0 and met the same issue.
unityRewardBug

@NVentimiglia
Copy link
Member

NVentimiglia commented Aug 5, 2021

Ok, I am still unable to replicate.

What I would like you to do is open up a case here, on the google admob sdk support group and link this github issue. If you can include a minimal sample of this issue, I would love to fix this.

@desouse
Copy link
Author

desouse commented Aug 6, 2021

Done.
https://groups.google.com/g/google-admob-ads-sdk/c/ZMgTQfg2YTs

@NVentimiglia
Copy link
Member

I was unable to replicate this issue with the AppLovin plugin. When testing AdReword showed before AdClose, as expected. I have included my demo code below.

    public void RequestAndLoadRewardedAd()
    {
        statusText.text = "Requesting Rewarded Ad.";

        // create new rewarded ad instance
        rewardedAd = new RewardedAd(adUnitId);

        rewardedAd.OnAdClosed += (sender, args) =>
        {
            MobileAdsEventExecutor.ExecuteInUpdate(() => {
                UnityEngine.Debug.Log("OnAdClosed");
            });

        };
        rewardedAd.OnUserEarnedReward += (sender, args) =>
        {
            MobileAdsEventExecutor.ExecuteInUpdate(() => {
                UnityEngine.Debug.Log("OnUserEarnedReward");
            });

        };

        // Create empty ad request
        rewardedAd.LoadAd(CreateAdRequest());
    }

@vizgl
Copy link

vizgl commented Jun 1, 2022

Got OnAdReceivedReward callback just after OnAdClosed fired(or even not called). Found this issue when show UnityAds ads through mediation.
So, users didn't received rewards, because I check reward in the OnAdClosed callback

Admob version is 7.0.1, Unity 2020.3.35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants