NativeCustomFormatAd and related types missing from Ads/Ads.Lite
Google Play Services Version
-
Xamarin.GooglePlayServices.Ads (version 121.3.0 onwards)
-
Xamarin.GooglePlayServices.Ads.Lite (version 121.3.0 onwards)
Describe your Issue
Between version 121.2.0 and version 121.3.0 there are a number of interfaces and classes that have gone missing. As far as I can tell they still exist in the original Google SDKs.
The missing definitions are:
- INativecustomFormatAdExtensions
- NativeCustomFormatAd
- NativeCustomFormatAdConstants
- INativeCustomFormatAd
- (others relating to NativeCustomFormatAd)
Relevant information
You can compare https://www.fuget.org/packages/Xamarin.GooglePlayServices.Ads.Lite/121.2.0/lib/net6.0-android31.0/Xamarin.GooglePlayServices.Ads.Lite.dll/Android.Gms.Ads.NativeAd
and https://www.fuget.org/packages/Xamarin.GooglePlayServices.Ads.Lite/121.3.0/lib/net6.0-android31.0/Xamarin.GooglePlayServices.Ads.Lite.dll/Android.Gms.Ads.NativeAd
Under the Android.Gms.Ads.NativeAd namespace you can see the missing interfaces.
Steps to Reproduce (with link to sample solution if possible):
Download and build https://github.com/jump32/ads-test (should build ok) Update Xamarin.GooglePlayServices.Ads.Lite to 121.3.0 or greater Rebuild (should fail with unknown type)
I fixed the problem.. we can use my libraries :
<PackageReference Include="Anjo.Android.GoogleServices.Ads" Version="22.0.0" />
<PackageReference Include="Anjo.Android.GoogleServices.AdsBase" Version="22.0.0" />
<PackageReference Include="Anjo.Android.GoogleServices.AdsLite" Version="22.0.0" />
Supports fixing the problem of Loading ads using :
- Let's rename for Interstitial ads InterstitialAdLoadCallback to AnjoInterstitialLoadCallback.
- Let's rename for Rewarded ads RewardedAdLoadCallback to AnjoRewardedLoadCallback.
- Let's rename for App Open Ads AppOpenAd.AppOpenAdLoadCallback to AnjoAppOpenLoadCallback.
- Let's rename for Rewarded interstitial ads RewardedInterstitialAdLoadCallback to AnjoRewardedInterstitialLoadCallback.
I'd prefer the original packages to be fixed.
Investigating namespace Android.Gms.Ads.NativeAd (package package)
Version 21.2.0:
jar tvf ./play-services-ads-lite-21.2.0.aar/classes.jar | grep "com/google/android/gms/ads/nativead/"
results:
1259 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/AdChoicesView.class
2571 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/MediaView.class
797 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAd$AdChoicesInfo.class
646 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAd$Image.class
469 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAd$OnNativeAdLoadedListener.class
495 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAd$UnconfirmedClickListener.class
2659 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAd.class
963 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAdAssetNames.class
347 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAdOptions$AdChoicesPlacement.class
2825 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAdOptions$Builder.class
355 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAdOptions$NativeMediaAspectRatio.class
2295 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAdOptions.class
10410 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAdView.class
4102 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAdViewHolder.class
475 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeCustomFormatAd$DisplayOpenMeasurement.class
520 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeCustomFormatAd$OnCustomClickListener.class
523 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeCustomFormatAd$OnCustomFormatAdLoadedListener.class
1763 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeCustomFormatAd.class
369 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/zzb.class
369 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/zzc.class
Version 21.3.0:
jar tvf ./play-services-ads-lite-21.3.0.aar/classes.jar | grep "com/google/android/gms/ads/nativead/"
results:
1259 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/AdChoicesView.class
3390 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/MediaView.class
797 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAd$AdChoicesInfo.class
646 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAd$Image.class
469 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAd$OnNativeAdLoadedListener.class
495 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAd$UnconfirmedClickListener.class
2659 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAd.class
963 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAdAssetNames.class
347 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAdOptions$AdChoicesPlacement.class
2825 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAdOptions$Builder.class
355 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAdOptions$NativeMediaAspectRatio.class
2295 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAdOptions.class
10410 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAdView.class
4102 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAdViewHolder.class
475 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeCustomFormatAd$DisplayOpenMeasurement.class
520 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeCustomFormatAd$OnCustomClickListener.class
523 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeCustomFormatAd$OnCustomFormatAdLoadedListener.class
1949 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeCustomFormatAd.class
369 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/zzb.class
369 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/zzc.class
Version currently bound:
jar tvf ./externals/com.google.android.gms/play-services-ads-lite/classes.jar | grep "com/google/android/gms/ads/nativead/"
1259 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/AdChoicesView.class
3537 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/MediaView.class
797 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAd$AdChoicesInfo.class
646 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAd$Image.class
469 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAd$OnNativeAdLoadedListener.class
495 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAd$UnconfirmedClickListener.class
2779 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAd.class
963 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAdAssetNames.class
347 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAdOptions$AdChoicesPlacement.class
3377 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAdOptions$Builder.class
355 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAdOptions$NativeMediaAspectRatio.class
353 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAdOptions$SwipeGestureDirection.class
2744 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAdOptions.class
10369 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAdView.class
4093 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAdViewHolder.class
475 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeCustomFormatAd$DisplayOpenMeasurement.class
520 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeCustomFormatAd$OnCustomClickListener.class
523 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeCustomFormatAd$OnCustomFormatAdLoadedListener.class
1665 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeCustomFormatAd.class
369 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/zzb.class
369 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/zzc.class
MCWs:
ll generated/com.google.android.gms.play-services-ads-lite/obj/Debug/monoandroid12.0/generated/src/Android.Gms.Ads.NativeAd.*
results:
-rw-r--r-- 1 user wheel 7680 Aug 27 18:59 generated/com.google.android.gms.play-services-ads-lite/obj/Debug/monoandroid12.0/generated/src/Android.Gms.Ads.NativeAd.AdChoicesView.cs
-rw-r--r-- 1 user wheel 9573 Aug 27 18:59 generated/com.google.android.gms.play-services-ads-lite/obj/Debug/monoandroid12.0/generated/src/Android.Gms.Ads.NativeAd.MediaView.cs
-rw-r--r-- 1 user wheel 87761 Aug 27 18:59 generated/com.google.android.gms.play-services-ads-lite/obj/Debug/monoandroid12.0/generated/src/Android.Gms.Ads.NativeAd.NativeAd.cs
-rw-r--r-- 1 user wheel 5058 Aug 27 18:59 generated/com.google.android.gms.play-services-ads-lite/obj/Debug/monoandroid12.0/generated/src/Android.Gms.Ads.NativeAd.NativeAdAssetNames.cs
-rw-r--r-- 1 user wheel 42261 Aug 27 18:59 generated/com.google.android.gms.play-services-ads-lite/obj/Debug/monoandroid12.0/generated/src/Android.Gms.Ads.NativeAd.NativeAdOptions.cs
-rw-r--r-- 1 user wheel 30723 Aug 27 18:59 generated/com.google.android.gms.play-services-ads-lite/obj/Debug/monoandroid12.0/generated/src/Android.Gms.Ads.NativeAd.NativeAdView.cs
-rw-r--r-- 1 user wheel 6986 Aug 27 18:59 generated/com.google.android.gms.play-services-ads-lite/obj/Debug/monoandroid12.0/generated/src/Android.Gms.Ads.NativeAd.NativeAdViewHolder.cs
@jump32 Thanks for the feedback.
Can you please elaborate this:
As far as I can tell they still exist in the original Google SDKs.
The missing definitions are:
- INativecustomFormatAdExtensions
- NativeCustomFormatAd
- NativeCustomFormatAdConstants
- INativeCustomFormatAd
- (others relating to NativeCustomFormatAd)
INativeCustomFormatAd is missing and I am investigating why, but I other types you mentioned are not available in both 21.2.0 and 21.3.0..
- (others relating to NativeCustomFormatAd)
Which other related types would that be?
Mel's research from Discord:
obj/Debug/monoandroid12.0/api.xml(4354,6): warning BG8503: Invalidating
'Android.Gms.Ads.NativeAd.INativeCustomFormatAd' and all its nested types because some of its methods were invalid.
[./generated/com.google.android.gms.play-services-ads-lite/com.google.android.gms.play-services-ads-lite.csproj]
leads to
obj/Debug/monoandroid12.0/api.xml(4362,8): warning BG8701: Invalid return type 'com.google.android.gms.ads.MediaContent'
for member 'Android.Gms.Ads.NativeAd.INativeCustomFormatAd.GetMediaContent ()'.
[./generated/com.google.android.gms.play-services-ads-lite/com.google.android.gms.play-services-ads-lite.csproj]
further MediaContent points to:
obj/Debug/monoandroid12.0/api.xml(685,6): warning BG8503: Invalidating 'Android.Gms.Ads.IMediaContent' and all its nested
types because some of its methods were invalid. [./generated/com.google.android.gms.play-services-ads-
lite/com.google.android.gms.play-services-ads-lite.csproj]
and that leads to:
obj/Debug/monoandroid12.0/api.xml(695,8): warning BG8700: Unknown return type
'com.google.android.gms.internal.ads.zzbff' for member 'Android.Gms.Ads.IMediaContent.Zza ()'.
[./generated/com.google.android.gms.play-services-ads-lite/com.google.android.gms.play-services-ads-lite.csproj]
So, 2 interfaces were transitively removed because some obfuscated type has invalid return type.
Hi @moljac
Having initially identified the issue, I was just comparing the fuget links I posted. So as far as I can see from those two links, the missing types are:
NativeCustomFormatAdOnCustomClickEventArgs NativeCustomFormatAdOnCustomFormatAdLoadedEventArgs INativeCustomFormatAdExtensions NativeCustomFormatAd NativeCustomFormatAdConsts INativeCustomFormatAd INativeCustomFormatAdDisplayOpenMeasurement INativeCustomFormatAdOnCustomClickListener INativeCustomFormatAdOnCustomFormatAdLoadedListener
Since they are all related to NativeCustomFormatAd, if you manage to restore that class I suspect the other will be restored as well.
Hi @moljac Is there any progress on this?
No.Not yet.
It's been a few months now. Any fix soon?
I fixed the problem.. we can use my libraries :
<PackageReference Include="Anjo.Android.GoogleServices.Ads" Version="22.0.0" /> <PackageReference Include="Anjo.Android.GoogleServices.AdsBase" Version="22.0.0" /> <PackageReference Include="Anjo.Android.GoogleServices.AdsLite" Version="22.0.0" />Supports fixing the problem of Loading ads using :
- Let's rename for Interstitial ads InterstitialAdLoadCallback to AnjoInterstitialLoadCallback.
- Let's rename for Rewarded ads RewardedAdLoadCallback to AnjoRewardedLoadCallback.
- Let's rename for App Open Ads AppOpenAd.AppOpenAdLoadCallback to AnjoAppOpenLoadCallback.
- Let's rename for Rewarded interstitial ads RewardedInterstitialAdLoadCallback to AnjoRewardedInterstitialLoadCallback.
But you did not fix the problem? All the issues on this ticket are present on your nuget package, as there is no NativeCustomFormatAd, no MediaContent, etc...
Please address this issue:
The InterstitialAdLoadCallback currently has the following override: public override void OnAdLoaded(Java.Lang.Object p0) { }
However, it should be: public override void OnAdLoaded(InterstitialAd ad) { }
This works correctly in Xamarin.GooglePlayServices.Ads 122.1.0.2, but it is not functioning as expected in the current release Xamarin.GooglePlayServices.Ads 123.6.0.1.
It’s crucial for us to resolve this as we need to start using MAUI in production.
Please address this issue:
The InterstitialAdLoadCallback currently has the following override: public override void OnAdLoaded(Java.Lang.Object p0) { }
No. It does not. InterstitialAdLoadCallback is abstract class:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable restore
using System;
using System.Collections.Generic;
using Android.Runtime;
using Java.Interop;
namespace Android.Gms.Ads.Interstitial {
// Metadata.xml XPath class reference: path="/api/package[@name='com.google.android.gms.ads.interstitial']/class[@name='InterstitialAdLoadCallback']"
[global::Android.Runtime.Register ("com/google/android/gms/ads/interstitial/InterstitialAdLoadCallback", DoNotGenerateAcw=true)]
public abstract partial class InterstitialAdLoadCallback : global::Android.Gms.Ads.AdLoadCallback {
static readonly JniPeerMembers _members = new XAPeerMembers ("com/google/android/gms/ads/interstitial/InterstitialAdLoadCallback", typeof (InterstitialAdLoadCallback));
internal static new IntPtr class_ref {
get { return _members.JniPeerType.PeerReference.Handle; }
}
[global::System.Diagnostics.DebuggerBrowsable (global::System.Diagnostics.DebuggerBrowsableState.Never)]
[global::System.ComponentModel.EditorBrowsable (global::System.ComponentModel.EditorBrowsableState.Never)]
public override global::Java.Interop.JniPeerMembers JniPeerMembers {
get { return _members; }
}
[global::System.Diagnostics.DebuggerBrowsable (global::System.Diagnostics.DebuggerBrowsableState.Never)]
[global::System.ComponentModel.EditorBrowsable (global::System.ComponentModel.EditorBrowsableState.Never)]
protected override IntPtr ThresholdClass {
get { return _members.JniPeerType.PeerReference.Handle; }
}
[global::System.Diagnostics.DebuggerBrowsable (global::System.Diagnostics.DebuggerBrowsableState.Never)]
[global::System.ComponentModel.EditorBrowsable (global::System.ComponentModel.EditorBrowsableState.Never)]
protected override global::System.Type ThresholdType {
get { return _members.ManagedPeerType; }
}
protected InterstitialAdLoadCallback (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer)
{
}
// Metadata.xml XPath constructor reference: path="/api/package[@name='com.google.android.gms.ads.interstitial']/class[@name='InterstitialAdLoadCallback']/constructor[@name='InterstitialAdLoadCallback' and count(parameter)=0]"
[Register (".ctor", "()V", "")]
public unsafe InterstitialAdLoadCallback () : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer)
{
const string __id = "()V";
if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero)
return;
try {
var __r = _members.InstanceMethods.StartCreateInstance (__id, ((object) this).GetType (), null);
SetHandle (__r.Handle, JniHandleOwnership.TransferLocalRef);
_members.InstanceMethods.FinishCreateInstance (__id, this, null);
} finally {
}
}
}
[global::Android.Runtime.Register ("com/google/android/gms/ads/interstitial/InterstitialAdLoadCallback", DoNotGenerateAcw=true)]
internal partial class InterstitialAdLoadCallbackInvoker : InterstitialAdLoadCallback {
public InterstitialAdLoadCallbackInvoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer)
{
}
static readonly JniPeerMembers _members = new XAPeerMembers ("com/google/android/gms/ads/interstitial/InterstitialAdLoadCallback", typeof (InterstitialAdLoadCallbackInvoker));
[global::System.Diagnostics.DebuggerBrowsable (global::System.Diagnostics.DebuggerBrowsableState.Never)]
[global::System.ComponentModel.EditorBrowsable (global::System.ComponentModel.EditorBrowsableState.Never)]
public override global::Java.Interop.JniPeerMembers JniPeerMembers {
get { return _members; }
}
[global::System.Diagnostics.DebuggerBrowsable (global::System.Diagnostics.DebuggerBrowsableState.Never)]
[global::System.ComponentModel.EditorBrowsable (global::System.ComponentModel.EditorBrowsableState.Never)]
protected override global::System.Type ThresholdType {
get { return _members.ManagedPeerType; }
}
}
}
Decompiled java counterpart
package com.google.android.gms.ads.interstitial;
import com.google.android.gms.ads.*;
public abstract class InterstitialAdLoadCallback extends AdLoadCallback<InterstitialAd>
{
}
However, it should be: public override void OnAdLoaded(InterstitialAd ad) { }
This method is defined in Android.Gms.Ads.AdLoadCallback.cs in generic base class Android.Gms.Ads.AdLoadCallback
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable restore
using System;
using System.Collections.Generic;
using Android.Runtime;
using Java.Interop;
namespace Android.Gms.Ads {
// Metadata.xml XPath class reference: path="/api/package[@name='com.google.android.gms.ads']/class[@name='AdLoadCallback']"
[global::Android.Runtime.Register ("com/google/android/gms/ads/AdLoadCallback", DoNotGenerateAcw=true)]
[global::Java.Interop.JavaTypeParameters (new string [] {"AdT"})]
public abstract partial class AdLoadCallback : global::Java.Lang.Object {
static readonly JniPeerMembers _members = new XAPeerMembers ("com/google/android/gms/ads/AdLoadCallback", typeof (AdLoadCallback));
internal static IntPtr class_ref {
get { return _members.JniPeerType.PeerReference.Handle; }
}
[global::System.Diagnostics.DebuggerBrowsable (global::System.Diagnostics.DebuggerBrowsableState.Never)]
[global::System.ComponentModel.EditorBrowsable (global::System.ComponentModel.EditorBrowsableState.Never)]
public override global::Java.Interop.JniPeerMembers JniPeerMembers {
get { return _members; }
}
[global::System.Diagnostics.DebuggerBrowsable (global::System.Diagnostics.DebuggerBrowsableState.Never)]
[global::System.ComponentModel.EditorBrowsable (global::System.ComponentModel.EditorBrowsableState.Never)]
protected override IntPtr ThresholdClass {
get { return _members.JniPeerType.PeerReference.Handle; }
}
[global::System.Diagnostics.DebuggerBrowsable (global::System.Diagnostics.DebuggerBrowsableState.Never)]
[global::System.ComponentModel.EditorBrowsable (global::System.ComponentModel.EditorBrowsableState.Never)]
protected override global::System.Type ThresholdType {
get { return _members.ManagedPeerType; }
}
protected AdLoadCallback (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer)
{
}
// Metadata.xml XPath constructor reference: path="/api/package[@name='com.google.android.gms.ads']/class[@name='AdLoadCallback']/constructor[@name='AdLoadCallback' and count(parameter)=0]"
[Register (".ctor", "()V", "")]
public unsafe AdLoadCallback () : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer)
{
const string __id = "()V";
if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero)
return;
try {
var __r = _members.InstanceMethods.StartCreateInstance (__id, ((object) this).GetType (), null);
SetHandle (__r.Handle, JniHandleOwnership.TransferLocalRef);
_members.InstanceMethods.FinishCreateInstance (__id, this, null);
} finally {
}
}
static Delegate? cb_onAdFailedToLoad_Lcom_google_android_gms_ads_LoadAdError_;
#pragma warning disable 0169
static Delegate GetOnAdFailedToLoad_Lcom_google_android_gms_ads_LoadAdError_Handler ()
{
if (cb_onAdFailedToLoad_Lcom_google_android_gms_ads_LoadAdError_ == null)
cb_onAdFailedToLoad_Lcom_google_android_gms_ads_LoadAdError_ = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPL_V (n_OnAdFailedToLoad_Lcom_google_android_gms_ads_LoadAdError_));
return cb_onAdFailedToLoad_Lcom_google_android_gms_ads_LoadAdError_;
}
static void n_OnAdFailedToLoad_Lcom_google_android_gms_ads_LoadAdError_ (IntPtr jnienv, IntPtr native__this, IntPtr native_p0)
{
var __this = global::Java.Lang.Object.GetObject<global::Android.Gms.Ads.AdLoadCallback> (jnienv, native__this, JniHandleOwnership.DoNotTransfer)!;
var p0 = global::Java.Lang.Object.GetObject<global::Android.Gms.Ads.LoadAdError> (native_p0, JniHandleOwnership.DoNotTransfer);
__this.OnAdFailedToLoad (p0!);
}
#pragma warning restore 0169
// Metadata.xml XPath method reference: path="/api/package[@name='com.google.android.gms.ads']/class[@name='AdLoadCallback']/method[@name='onAdFailedToLoad' and count(parameter)=1 and parameter[1][@type='com.google.android.gms.ads.LoadAdError']]"
[Register ("onAdFailedToLoad", "(Lcom/google/android/gms/ads/LoadAdError;)V", "GetOnAdFailedToLoad_Lcom_google_android_gms_ads_LoadAdError_Handler")]
public virtual unsafe void OnAdFailedToLoad (global::Android.Gms.Ads.LoadAdError p0)
{
const string __id = "onAdFailedToLoad.(Lcom/google/android/gms/ads/LoadAdError;)V";
try {
JniArgumentValue* __args = stackalloc JniArgumentValue [1];
__args [0] = new JniArgumentValue ((p0 == null) ? IntPtr.Zero : ((global::Java.Lang.Object) p0).Handle);
_members.InstanceMethods.InvokeVirtualVoidMethod (__id, this, __args);
} finally {
global::System.GC.KeepAlive (p0);
}
}
static Delegate? cb_onAdLoaded_Ljava_lang_Object_;
#pragma warning disable 0169
static Delegate GetOnAdLoaded_Ljava_lang_Object_Handler ()
{
if (cb_onAdLoaded_Ljava_lang_Object_ == null)
cb_onAdLoaded_Ljava_lang_Object_ = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPL_V (n_OnAdLoaded_Ljava_lang_Object_));
return cb_onAdLoaded_Ljava_lang_Object_;
}
static void n_OnAdLoaded_Ljava_lang_Object_ (IntPtr jnienv, IntPtr native__this, IntPtr native_p0)
{
var __this = global::Java.Lang.Object.GetObject<global::Android.Gms.Ads.AdLoadCallback> (jnienv, native__this, JniHandleOwnership.DoNotTransfer)!;
var p0 = global::Java.Lang.Object.GetObject<global::Java.Lang.Object> (native_p0, JniHandleOwnership.DoNotTransfer);
__this.OnAdLoaded (p0!);
}
#pragma warning restore 0169
// Metadata.xml XPath method reference: path="/api/package[@name='com.google.android.gms.ads']/class[@name='AdLoadCallback']/method[@name='onAdLoaded' and count(parameter)=1 and parameter[1][@type='AdT']]"
[Register ("onAdLoaded", "(Ljava/lang/Object;)V", "GetOnAdLoaded_Ljava_lang_Object_Handler")]
public virtual unsafe void OnAdLoaded (global::Java.Lang.Object p0)
{
const string __id = "onAdLoaded.(Ljava/lang/Object;)V";
IntPtr native_p0 = JNIEnv.ToLocalJniHandle (p0);
try {
JniArgumentValue* __args = stackalloc JniArgumentValue [1];
__args [0] = new JniArgumentValue (native_p0);
_members.InstanceMethods.InvokeVirtualVoidMethod (__id, this, __args);
} finally {
JNIEnv.DeleteLocalRef (native_p0);
global::System.GC.KeepAlive (p0);
}
}
}
[global::Android.Runtime.Register ("com/google/android/gms/ads/AdLoadCallback", DoNotGenerateAcw=true)]
internal partial class AdLoadCallbackInvoker : AdLoadCallback {
public AdLoadCallbackInvoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer)
{
}
static readonly JniPeerMembers _members = new XAPeerMembers ("com/google/android/gms/ads/AdLoadCallback", typeof (AdLoadCallbackInvoker));
[global::System.Diagnostics.DebuggerBrowsable (global::System.Diagnostics.DebuggerBrowsableState.Never)]
[global::System.ComponentModel.EditorBrowsable (global::System.ComponentModel.EditorBrowsableState.Never)]
public override global::Java.Interop.JniPeerMembers JniPeerMembers {
get { return _members; }
}
[global::System.Diagnostics.DebuggerBrowsable (global::System.Diagnostics.DebuggerBrowsableState.Never)]
[global::System.ComponentModel.EditorBrowsable (global::System.ComponentModel.EditorBrowsableState.Never)]
protected override global::System.Type ThresholdType {
get { return _members.ManagedPeerType; }
}
}
}
Decompiled java counterpart:
package com.google.android.gms.ads;
import androidx.annotation.*;
public abstract class AdLoadCallback<AdT>
{
public void onAdFailedToLoad(@NonNull final LoadAdError loadAdError) {
}
public void onAdLoaded(@NonNull final AdT adT) {
}
}
Everything seems fine.
This works correctly in Xamarin.GooglePlayServices.Ads 122.1.0.2, but it is not functioning as expected in the current release Xamarin.GooglePlayServices.Ads 123.6.0.1.
OK. For that I need to compare 2 versions and I won't have time that soon.