-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdMobBannerRenderer.cs
More file actions
33 lines (26 loc) · 1003 Bytes
/
Copy pathAdMobBannerRenderer.cs
File metadata and controls
33 lines (26 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Drawing;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using GoogleAdMobAds;
using MonoTouch.UIKit;
using BabbyJotz;
using BabbyJotz.iOS;
[assembly: ExportRenderer(typeof(AdMobBanner), typeof(AdMobBannerRenderer))]
namespace BabbyJotz.iOS {
public class AdMobBannerRenderer : ViewRenderer {
const string AdMobId = "ca-app-pub-8697950901186247/2337591611";
protected override void OnElementChanged(ElementChangedEventArgs<View> e) {
base.OnElementChanged(e);
var view = new GADBannerView(size: GADAdSizeCons.Banner, origin: new PointF(0, 0)) {
AdUnitID = AdMobId,
RootViewController = UIApplication.SharedApplication.Windows[0].RootViewController
};
view.DidReceiveAd += (sender, args) => {
// Nothing to do right now.
};
view.LoadRequest(GADRequest.Request);
base.SetNativeControl(view);
}
}
}