2012-12-17 3 views

답변

2

monotouch-bindings 리포지토리의 AdMob bindings에 몇 가지 문제가 있습니다. 하지만 그때 나는 AlexTouch.GoogleAdMobAds 바인딩으로 전환했으며 그 (것)들은 다만 중대한 작동한다. Github의 README에 AlexTouch.GoogleAdMobAds를 사용하는 샘플을 찾을 수 있습니다. 그렇습니다. 아주 간단 합니다만 도움이 필요하면 더 자세한 질문을하십시오.

+0

대단히 감사합니다. AlexTouch.GoogleAdMobAds로 작성했습니다. 나중에 코드를 붙여 넣습니다. – user1908944

+0

둘 다 당신을 위해 기쁜 내 바인딩을했습니다 :) – dalexsoto

+0

고마워. XD – user1908944

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); 
      } 
     }); 
관련 문제