EtienneP EtienneP - 1 year ago 126
iOS Question

Xamarin.iOS Google Ads Targeting

I want to integrate Google Ads in my app, but I am stuck when it's time to load the request and get the Ad.

What I need is to pass targeting parameters to load an Ad related to my user's search.

I'm trying to load a

for displaying a
, but no method seems to match my needs. The
methods of the
do not accept
. They only accept
and no cast exists between those two classes.

However, the original Google docs says it's possible:

Here is my code:

this.banner = new SearchBannerView(AdSizeCons.Banner, new CGPoint(0, 0));
this.banner.TranslatesAutoresizingMaskIntoConstraints = false;
this.banner.AdSize = AdSizeCons.Banner;
this.banner.AdUnitID = this.AdService.AdMobUnitId;
this.banner.AdReceived += this.AdReceived;
this.banner.RootViewController = UIApplication.SharedApplication.KeyWindow.RootViewController;

var request = new SearchRequest();
request.Query = ((GoogleAdViewModel)this.DataContext).Query;

// my request isn't accepted

Has anyone succeed to make
load something using the Google Ads component from Xamarin?

It's for an iOS app and I'm using this component:

Answer Source

This question was answered here.

It was an issue in the binding library, the type SearchRequest had a wrong base type (NSObject instead of GADRequest).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download