【发布时间】:2016-08-01 07:32:43
【问题描述】:
我想将 Google Ads 集成到我的应用中,但在加载请求和获取广告时遇到了困难。
我需要传递定位参数以加载与我的用户搜索相关的广告。
我正在尝试加载 SearchRequest 以显示 SearchBannerView,但似乎没有任何方法符合我的需求。 SearchBannerView 的 LoadRequest 方法不接受 SearchRequest。他们只接受Request 并且这两个类之间不存在演员表。
但是,原始 Google 文档说这是可能的:https://developers.google.com/mobile-ads-sdk/docs/search-ads-for-apps/ios/
这是我的代码:
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
this.banner.LoadRequest(request);
有没有人成功让SearchBannerView 使用 Xamarin 的 Google Ads 组件加载某些内容?
这是一个 iOS 应用程序,我正在使用这个组件:https://components.xamarin.com/view/googleiosmobileads。
【问题讨论】:
标签: ios xamarin.ios ads adsense