I am trying to do this for a few days, and still cannot make it. And I tried to find some samples but they are all on Android. Did anyone succeed to integrate admob on iOS?
Asked
Active
Viewed 1,228 times
2 Answers
2
I had some problems with AdMob bindings from monotouch-bindings repository. But then I switched to AlexTouch.GoogleAdMobAds bindings and them works just great. You can find sample of using AlexTouch.GoogleAdMobAds in README on Github. Is is quite simple, but if you'll need some help - feel free to ask more detailed question.

olexa.le
- 1,697
- 10
- 14
-
Thank you very much, I made it with AlexTouch.GoogleAdMobAds, i will paste my code here later. – user1908944 Dec 17 '12 at 14:34
-
Everything works well until I click on one AD that links to some website not appstore, the banner just rotate and disappear, nothing shows. Have you ever encounter this? i am working on it now. – user1908944 Dec 18 '12 at 03:45
0
// code for admob "using AlexTouch.GoogleAdMobAds"
UIViewController vc = new UIViewController ();
UIViewController controller = UIApplication.SharedApplication.Windows [0].RootViewController;
var ad = new GADBannerView (GADAdSizeCons.SmartBannerLandscape, new PointF (0, 0))
{
AdUnitID = "ADMOB_ID",
RootViewController = vc
};
ad.Hidden = false;
ad.DidReceiveAd += delegate {
ad.Hidden = false;
ad.Frame = new System.Drawing.RectangleF (0, (int) 0, (int) (ad.Bounds.Width), (int) (ad.Bounds.Height));
Console.WriteLine ("AD Received");
};
ad.DidFailToReceiveAdWithError += delegate(object sender, GADBannerViewDidFailWithErrorEventArgs e) {
ad.Hidden = true;
Console.WriteLine (e.Error);
};
ad.WillPresentScreen += delegate {
Console.WriteLine ("showing new screen");
};
ad.WillLeaveApplication += delegate {
Console.WriteLine ("I will leave application");
};
ad.WillDismissScreen += delegate {
Console.WriteLine ("Dismissing opened screen");
};
ad.UserInteractionEnabled = true;
vc.View.AddSubview(ad);
vc.View.Frame = new System.Drawing.RectangleF(0f, 0f, (int)(ad.Bounds.Width), (int)(ad.Bounds.Height));
controller.View.AddSubview(vc.View);
Task.Factory.StartNew(() => {
while (true)
{
Console.WriteLine("Requesting Ad");
InvokeOnMainThread (delegate {
GADRequest r = new GADRequest();
ad.LoadRequest(r);
});
System.Threading.Thread.Sleep(30000);
}
});

user1908944
- 43
- 4