Search code examples
c#xamarinadsrewardedvideoad

xamarin RewardedVideo how to replace 'this'


enter image description here

enter image description here

I have tried to copy https://forums.xamarin.com/discussion/66452/xamarin-admob-rewardedvideoad for my app but i cannot add a RewardedVideoAdListener Every help would be appreciated


Solution

  • Your class appears to be derived from a class or interface in the AdsGoogle.Droid namespace, while the sample you are linking to is using a class or interface in the Android.GMS namespace. This suggests that you are trying to use a tutorial for some other product to integrate with Google Ads? The error you are getting says that the compiler doesn't know how to convert between the AdsGoogle.Droid version of the class (your class) and the Android.GMS version of the class (the class type that it is expecting).

    To make the problem clear, you can have two classes with the same name as long as they are in different namespaces. The using statements at the top of the page are used to tell the compiler which version of the class to use. If it could belong to either, you have to declare the full namespace and class name, for example, System.IO.File or MyNamespace.File instead of just File.

    To solve the problem, remove the line using AdsGoogle.Droid; Any errors that this causes will be coming from parts of code that don't have anything to do with the tutorial you are using - the tutorial doesn't use anything from that namespace.