3
votes

I developed a windows phone 8.1 app and I want to add Google ad mob adds to it. I followed the instructions in this link I added GoogleAds.dll to my Windows phone 8.1 references but in tools I dint find AdView control. I am using VS2013 express.

I tried through C# code too.

{
     AdView bannerAd = new AdView
      {
            Format = AdFormats.BANNER,
            AdUnitID = "MY_AD_UNIT_ID"
      };

          AdRequest adRequest = new AdRequest();
         _mygrid.Children.Add(bannerAd);
         bannerAd.LoadAd(adRequest);
    }

where _mygrid is a grid. can I add the Adview controller to Grid ?

When I try to build the solution I am getting following errors

Error 1 The type 'System.Windows.Controls.UserControl' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows, Version=2.0.6.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. c:\users\makot\documents\visual studio 2013\Projects\WC\WC\MainPage.xaml.cs

Error 2 The best overloaded method match for 'Windows.UI.Xaml.Controls.UIElementCollection.Add(Windows.UI.Xaml.UIElement)' has some invalid arguments c:\users\makot\documents\visual studio 2013\Projects\WC\WC\MainPage.xaml.cs

Error 3 Argument 1: cannot convert from 'GoogleAds.AdView' to 'Windows.UI.Xaml.UIElement' c:\users\makot\documents\visual studio 2013\Projects\WC\WC\MainPage.xaml.cs

1
Have you tried typing the XAML directly instead of dragging from the toolbox? If your reference is setup correctly and you have the relevant namespace declared in your XAML it should work just fine. Also maybe this more detailed guide will help windowsapptutorials.com/windows-phone/advertising/… - pumpkinszwan
I tried adding followong XAML code <GoogleAds:AdView AdUnitID="MY_AD_UNIT_ID" Format="MY_AD_FORMAT" /> but its saying the type "GoogleAds:AdView" not found. your guide ultimately leads to the same page that I posted above. I can see all the class of GoogleADS dll in Object browser in VS but How come I am unable to use that in project. am I missing any action after adding dll to it ? - Manikanta
Does your project have a reference to the dll? Right-click the project, Add > reference > choose 'Solution', then make sure the Google Ads project is selected with a little tick. - pumpkinszwan
Yes its enabled. I tried this code too : AdView bannerAd = new AdView { Format = AdFormats.BANNER, AdUnitID = "MY_AD_UNIT_ID" }; AdRequest adRequest = new AdRequest(); _mygrid.Children.Add(bannerAd); bannerAd.LoadAd(adRequest); Its throwing _mygrid has some Invalid argument - Manikanta
Is this a Windows Phone 8.1 app or a Windows Phone Silverlight 8.1 app? Based on what I've read online, it seems like the AdMob SDK only exists for the Silverlight phone platform. - eyebraus

1 Answers

2
votes

Google Ad mob SDK currently supports Silverlight (WP8/WP8.1 Silverlight) only. Although you can reference the mentioned dll to a WP8.1 RT project, it doesn't work.