software solutions for a mobile world

Using the adcontrol from code in Windows Phone 8

I have been writing a new app for Windows Phone 8, taking advantage of the new Nokia maps built into the platform. All was going swimmingly, maps work well and quickly, problem with AR which I am working on, but everything seemed OK in testing.

I decided I would use the adcontrol, and offer a low-price purchase option if people want to get rid of the ads (always assuming someone downloads it). I used the adcontrol when I ported Pop Quiz and implemented it in code - so:-

    try
    {
        adControlFSA = new AdControl("test_client",   // ApplicationID
                                                             "Image480_80",   // AdUnitID
                                                             true);           // isAutoRefreshEnabled
    }
    catch
    {
    }
    
    
  if (adControlFSA != null)
 {
     adControlFSA.Width = 480;
     adControlFSA.Height = 80;
     adControlFSA.VerticalAlignment = VerticalAlignment.Bottom;
     adControlFSA.HorizontalAlignment = HorizontalAlignment.Center;
     Grid grid = (Grid)this.LayoutRoot.Children[1];
     grid.Children.Add(adControlFSA);
 }
 

I plugged this in, ran the app, no errors, no adcontrol. Checked the visibility, the number of controls, the parent control, everything I could think of - still no dice. I then split the code out, generated a new project, targeting Windows Phone 8, ran the project - still no control!

Started a new project in VS2010 this time targeting 7.1, ran the project, and there was the ad control - WTF!!!

Chatted about it to colleagues, and twitterati, and still no joy. Reached out to Microsoft, and got the answer back - capabilities! The minimum capabilities you need are:-

 

 

Went back to my project, ran it, and the adcontrol appeared.

So if you hit the same problems - look at your capabilities.

Thanks Andy and Microsoft


Posted Dec 05 2012, 07:26 PM by Pete Vickers

Comments

Using the adcontrol from code in Windows Phone 8 wrote Using the adcontrol from code in Windows Phone 8
on 12-06-2012 11:48

Pingback from  Using the adcontrol from code in Windows Phone 8

Dew Drop–December 6, 2012 (#1,457) | Alvin Ashcraft's Morning Dew wrote Dew Drop–December 6, 2012 (#1,457) | Alvin Ashcraft's Morning Dew
on 12-06-2012 13:20

Pingback from  Dew Drop–December 6, 2012 (#1,457) | Alvin Ashcraft's Morning Dew

Interesting .NET Links - December 6 , 2012 | TechBlog wrote Interesting .NET Links - December 6 , 2012 | TechBlog
on 12-06-2012 15:43

Pingback from  Interesting .NET Links - December 6 , 2012 | TechBlog

Copyright © 2014 APPA Mundi Limited. All Rights Reserved. Terms of Use and Privacy Policy. OrcsWeb's Windows Cloud Server Hosting