GooglePlayServicesComponents icon indicating copy to clipboard operation
GooglePlayServicesComponents copied to clipboard

Xamarin.GooglePlayServices.Ads.Lite How is the InterstitialAdLoadCallback parameter used to load interstitial ads in the new version

Open Sergtek opened this issue 3 years ago • 3 comments

Xamarin.Android Version:

All.

Operating System & Version:

Windows 10

Packages used:

    <PackageReference Include="Xamarin.GooglePlayServices.Ads.Lite" Version="120.2.0" />
    <PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />

Describe your Issue

The new version 120.2.0 of the Xamarin.GooglePlayServices.Ads.Lite package brings with it many changes, new APIs, and name changes in various classes. I have been consulting the official documentation to do the appropriate refactorings (https://developers.google.com/admob/android/interstitial), I currently have this:

        public void Show(string adUnit)
        {
            var context = Application.Context;
            InterstitialAd.Load(context, adUnit, new AdRequest.Builder().Build(), ?);
        }

In the official documentation it says that the Load method must be called together with four parameters: the context, the ad id, adRequest and the InterstitialAdLoadCallback, this last parameter I do not understand how to pass it since in the documentation it appears as a new instance but in the Xamarin.GooglePlayServices.Ads.Lite nuget the InterstitialAdLoadCallback class appears as abstract, I would appreciate any help to help me understand how it works.

The documentation shows this example, but the InterstitialAdLoadCallback class cannot be passed in the same way by being abstract: InterstitialAd.load(this,"id", adRequest, new InterstitialAdLoadCallback()

Sergtek avatar Jun 24 '21 15:06 Sergtek