Admob Rewarded video not calling events after close and full video watch in unity

1,598 views
Skip to first unread message

Payal Zariya

unread,
Mar 18, 2019, 6:50:19 AM3/18/19
to Google Mobile Ads SDK Developers
hii 
One issue in Google Mobile Ads Unity Plugin using Google Mobile Ads Unity Plugin v3.15.0 . After watching video ads it not call any events.

Payal Zariya

unread,
Mar 18, 2019, 8:15:50 AM3/18/19
to Google Mobile Ads SDK Developers

mobileadssdk...@google.com

unread,
Mar 18, 2019, 1:33:50 PM3/18/19
to Payal Zariya, Google Mobile Ads SDK Developers
Hello Payal, 

Could you please follow the steps mentioned in this guide to implement the Rewarded video callbacks? You may also refer to our sample apps which includes the code samples for these callbacks. If you're still having an issue, could you please share the code snippets of your implementation so I can check this further.

Thanks,
Bharani Cherukuri
Mobile Ads SDK Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

M.Nenad

unread,
Apr 11, 2019, 10:47:06 AM4/11/19
to google-adm...@googlegroups.com
Hi Bharani, 

I'm facing the same issue as Payal:

Whenever I try to call a function out of HandleRewardBasedVideoRewarded() the android  application crashes.
The only function that works is Debug.Log("something")

I'm developing with: Unity 2018.3.0f2 for Android

I will post the code here:
void Start()
    {
        MobileAds.Initialize(appID); // app ID is  the real App-ID from AdMob
        rewardedAd = RewardBasedVideoAd.Instance;
        rewardedAd.OnAdRewarded += HandleRewardBasedVideoRewarded;
    }
void RequestRewardedAd()
    {
        Debug.Log("Requested RewardedAd");
        debugText.text = "Requested RewardedAd";

        AdRequest request = new AdRequest.Builder().AddTestDevice("testDeviceID").Build(); //  testDeviceID is a string with unique test device N°

        rewardedAd.LoadAd(request, DUMMY_rewardedAdID); // I'm using the rewarded ad test-ID provided by AdMob here
    }

// This is Button the player presses on the device to start the ad
    public void SHOW_REWARDED_AD()
    {
        StartCoroutine(ShowRewardedAd());
    }

    public IEnumerator ShowRewardedAd()
    {
// Request an rewarded ad
        RequestRewardedAd();
// wait for rewarded ad to load
        while (!rewardedAd.IsLoaded())
        Debug.Log("currently loading rewarded ad");
        debugText.text = "currently loading rewarded ad";
        yield return null;

       
        if (rewardedAd.IsLoaded())
        {
            Debug.Log("we reached leaded state");
            debugText.text = "we reached loaded state";
            rewardedAd.Show(); // Show the ad
        }
        else
        {
            Debug.Log("REWARDED-AD NOT LOADED! CHECK INTERNET CONNECTION AND APP_ID!!");
            debugText.text = "REWARDED-AD NOT LOADED! CHECK INTERNET CONNECTION AND APP_ID!!";
        }
    }

    ///////////////////////////////////////////
    /// HANDLE THE REWARDS THE PLAYER GETS ////
    /// ///////////////////////////////////////


    public void HandleRewardBasedVideoRewarded(object sender, Reward args)
    {
       
        Debug.Log("hello world"); // this gets printed
        string type = args.Type;
        double amount = args.Amount;
        Debug.Log("You have been awarded with " + amount.ToString() + " " + type); // this works as well

// APP CRASHES WHEN DOING ONE OF THE FOLLOWING THINGS:

        debugText.text = ("You have been awarded with " + amount.ToString() + " " + type); // this DOESN't WORK (And let's the application crash)
        RewardButton.SetActive(true); // this also let's the application crash
        ReceiveRewards(); // this also let's the application crash
        SomeOtherScriptFromTheProject.instance.SayHelloToWorld(); // also doesn't work

    }

    public void ReceiveReward()
    {
        debugText.text = "REWARDS HAVE BEEN RECEIVED";
        GemRewardButton.SetActive(false);
    }
}

I hope for help, as I am stuck with this for hours

Thank you very much

mobileadssdk...@google.com

unread,
Apr 11, 2019, 2:57:30 PM4/11/19
to M.Nenad, Google Mobile Ads SDK Developers
Hello, 

It looks like the crash is specific to your implementation. Based on your comments, the debug log where you received the rewards is working fine. Could you please recheck your implementation with our sample apps and let us know if you're having an issue?

Thanks,
Bharani Cherukuri
Mobile Ads SDK Team

Sashimi_Gamer

unread,
Sep 27, 2020, 11:57:41 PM9/27/20
to Google Mobile Ads SDK Developers
I think I have similar question, also need help.    I first have a watch video panel with watch video button and a cancel button,  use Ad event for reward video ads when player watched video panel will Set active to false and load a new scene,  after player watched video and closed,  panel still there and not loading.  Then if click on cancel button then it cancel so that means the game is not freeze.

<code>
      public void HandleRewardBasedVideoClosed(object sender, EventArgs args)
        {

       GameUI.retext = "Close";
        ui.GetComponent<GameUI>().text.text = "Closing";
        ui.GetComponent<GameUI>().watchPanel.SetActive(false);
         ui.GetComponent<GameUI>().Loading();
        RequestVideoAds();

        
    }

        public void HandleRewardBasedVideoRewarded(object sender, Reward args)
        {
        GameUI.retext2 = "Rewarded";
    }
</code>

Mobile Ads SDK Forum Advisor Prod

unread,
Sep 28, 2020, 2:55:44 AM9/28/20
to send.j...@gmail.com, google-adm...@googlegroups.com

Hi there,

Thank you for reaching out to us.

Could you kindly provide the details below (via Reply to author or a direct, private reply to this email) so that I can investigate the issue?


You may zip the entire Unity project (excluding the Library and Temp folders) in order to reduce its size, then send it to me via a shareable link from your Google Drive (or on any other file-sharing site that you prefer). Don't forget to send via Reply to author or a direct, private reply to this email.

Google Logo
Ziv Yves Sanchez
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q25XKDc:ref
Reply all
Reply to author
Forward
0 new messages