Admob Rewarded Video Reward

Hello all. I’m making Rewarded Video for my first android-game. I done all the same as in this video tutorial इनाम वाले विज्ञापन  |  Unity  |  Google for Developers. So then I created some button and when I push it - it starts method “ShowRewardBasedAd()”.

There is my code:

using System;
using UnityEngine;
using GoogleMobileAds;
using GoogleMobileAds.Api;

public class AdMobScript : MonoBehaviour
{
    private RewardBasedVideoAd rewardBasedVideoAd;

    public void Start()
    {
        rewardBasedVideoAd = RewardBasedVideoAd.Instance;

        rewardBasedVideoAd.OnAdRewarded += HandleOnAdRewarded;
    }

    public void LoadRewardBasedAd()
    {
        #if UNITY_EDITOR
            string adUnitId = "unused";
        #elif UNITY_ANDROID
            string adUnitId = "ca-app-pub-3940256099942544/5224354917";
        #elif UNITY_IPHONE
            string adUnitId = "ca-app-pub-3940256099942544/1712485313";
        #else
            string adUnitId = "unexpected_platform";
        #endif

        rewardBasedVideoAd.LoadAd(new AdRequest.Builder().Build(), adUnitId);
    }
    public void ShowRewardBasedAd()
    {
        if (rewardBasedVideoAd.IsLoaded())
        {
            rewardBasedVideoAd.Show();
        }
        else
        {
            MonoBehaviour.print("Dude, your ad's not loaded yet.");
        }
    }

    public void HandleOnAdRewarded(object sender, Reward args)
    {
        string type = args.Type;
        double amount = args.Amount;
        print("User rewarded with: " + amount.ToString() + " " + type);
    }
}

But, after I push this button, I think I must receive print("User rewarded with: " + amount.ToString() + " " + type); - But nothing happens. What wrong in my script? Can anyone help me, please?

Tried it on my android-phone and this not work at all. Can someone help me?

After I download Admob plugin in Unity, I created a script(this script is upwards), that attached to a empty GameObject. After this I made some prefab that spawns in game, made panel which appear after I collide with prefab and in this panel I have two buttons “Yes” and “No” and text asking if you want to watch video ad. So, after this to the button “Yes” to “OnClick” I attached GameObject with this script and call method “ShowRewardBasedAd()”.

After I touching button “Yes” in game on my phone it’s not showing anything. Please, give me advice about this rewarded video, I only learning Unity and dont understand how it works… I searching in google approximately for 5 hours and dont found anything that can help me :(:(:frowning:

Any help? :frowning:

You should probably post over here too:
https://groups.google.com/forum/#!categories/google-admob-ads-sdk/game-engines
That group is dedicated to admob and people use game engines. However on this forum, only a small number of people will have experience with it.

Sorry, don’t use admob. We use Unity ads. @TaleOf4Gamers_1 suggestion may be your best bet.

Just make sure admob even works in editor if that is where you’re testing it. Unity ads doesn’t work the same for example. Test it on mobile and use something like Log Viewer (free on the asset store) to view the console once built to mobile.

A quick look also at their example and it looks like they have other events you want to subscribe to. Stuff like failed to load and such. I would set those up as well and not just the rewarded as you may be hitting one of those without knowing it.

Thanks for all. I did it by myself :slight_smile: All was ok, problem was in that I must load video ad first. Topic can be closed.

if u got any update plz provide for us also

sir can u plz post the correct code…i have the same problem…plz its urgent

Following the example of iALNA, the only thing you should do is, INSIDE START() method, add:

LoadRewardBasedAd(); // To call the loading of an ad.

1 Like