Admob integration in Xamarin.Android

Hi,

I am trying to integrate Rewarded video ads in my xamarin android app. I have implemented Interstitial video ads also.

I have implemented the class InterstitialAdListener : AdListener{...} and all the methods from abstract class AdListener. All the events are fired when ad is closed, dismissed etc.

I have also implemented listener for rewarded ad like below

public class RewardedAdListener : IRewardedVideoAdListener
{
private readonly Context _context;
public IntPtr Handle { get; }

    public RewardedAdListener(Context context)
    {
        _context = context;
    }

    public void Dispose()
    {            
    }

    public void OnRewarded(IRewardItem reward)
    {
        var amount = reward.Amount; // 29

        var rewardType = reward.Type; // Kalingo6637403349Rewarded
    }

   // + ALL METHODS FROM INTERFACE IRewardedVideoAdListener

}

But these event handler are not getting called when i close ad or exit, etc. The debugger is not hit in VS.

I have registered the listener in my activity like below -

        _rewardedAdListener = new RewardedAdListener(this);            
        _rewardedVideoAd = MobileAds.GetRewardedVideoAdInstance(this);
        _rewardedVideoAd.RewardedVideoAdListener = _rewardedAdListener;

Can someone please help?

Thanks,
Rohan

Sign In or Register to comment.