ads not displaying

Jan 16, 2013 at 8:24 AM

Hi,

Maybe I am missing something super simple but I cannot get ads to show up in my app. Here is what it looks like when I run it: http://youtu.be/kt4WpUfhwik

Here is my code: 

<AdRotator:AdRotatorControl x:Name="NfAdRotator" Height="100" VerticalAlignment="Bottom" 
DefaultSettingsFileUri="/NutritionFacts.org;component/adSettings.xml"
SettingsUrl="http://domain.com/adSettings.xml" SlidingAdDirection="Bottom"
SlidingAdDisplaySeconds="10" DefaultAdType="AdMob" PubCenterAdUnitId="112958"
PubCenterAppId="b1c0db4c-0af8-4e60-a205-f9f04871c00d" IsEnabled="True"
AdMobAdUnitId="a150f65bae6e0ff "/>

My ad settings file looks like

<?xml version="1.0" encoding="utf-8"?>
<AdSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <CultureDescriptors>
    <AdCultureDescriptor CultureName="en-US">
      <Probabilities Probability="10" AdType="PubCenter" AppID="b1c0db4c-0af8-4e60-a205-f9f04871c00d" SecondaryID="112958" />
      <Probabilities Probability="90" AdType="AdMob" AppID="a150f65bae6e0ff"/>
        <!--<Probabilities AdType="DefaultHouseAd" AppID="http://xna-uk.net/AdRotator/SampleRemoteHouseAd.xaml"/>//-->
    </AdCultureDescriptor>
    <AdCultureDescriptor CultureName="en-GB">
      <Probabilities Probability="20" AdType="PubCenter" AppID="b1c0db4c-0af8-4e60-a205-f9f04871c00d" SecondaryID="112958" />
      <Probabilities Probability="25" AdType="AdMob" AppID="a150f65bae6e0ff "/>
      <!--<Probabilities AdType="DefaultHouseAd" AppID="http://xna-uk.net/AdRotator/SampleRemoteHouseAd.xaml"/>//-->
    </AdCultureDescriptor>
    <AdCultureDescriptor CultureName="de-DE">
      <Probabilities Probability="25" AdType="PubCenter" AppID="b1c0db4c-0af8-4e60-a205-f9f04871c00d" SecondaryID="112958" />
      <Probabilities Probability="25" AdType="AdMob" AppID="a150f65bae6e0ff "/>
      <!--<Probabilities AdType="DefaultHouseAd" AppID="http://xna-uk.net/AdRotator/SampleRemoteHouseAd.xaml"/>//-->
    </AdCultureDescriptor>
    <AdCultureDescriptor CultureName="default">
      <Probabilities Probability="10" AdType="PubCenter" AppID="b1c0db4c-0af8-4e60-a205-f9f04871c00d" SecondaryID="112958" />
      <Probabilities Probability="90" AdType="AdMob" AppID="a150f65bae6e0ff "/>      
      <!--<Probabilities AdType="DefaultHouseAd" AppID="http://xna-uk.net/AdRotator/SampleRemoteHouseAd.xaml"/>//-->
    </AdCultureDescriptor>
    </CultureDescriptors>
</AdSettings>

I have the NfAdRotator.Invalidate(); in my on_page_load method.

Any help would be much appreciated. This is the Silverlight ver of adRotator for Windows Phone 7.1

Sincerely,

Kamal

Coordinator
Jan 16, 2013 at 10:12 AM

The config looks good, but a few other things to check:

  1. Is the build action for the config file is set to "resource"
  2. Best to not comment out lines in the config file, just remove them and add them back later if you need them
  3. You don't need to set your publisher and Adunit iID's in BOTH the config file and the AdControl, won't hurt but the XAML settings will override the config so you won't be able to change them without recompiling
  4. Dont put dummy data in the Settings URL, again either use a proper (free?) host where the file is held or don't provide the setting,  again won't stop it from working but could cause issues later
  5. Lastly can you confirm the namespace for your the project where the config file is located is "NutritionFacts.org".  Although it shouldn't cause an issue probably best not use use "." in namespace names with SL.

Have you also tried replicating your config in a test project just to ensure your AdSettings are correct and that you are getting Ad's delivered to those ID's?

Jan 17, 2013 at 7:32 AM

Thanks for the tip! I will try them out and report the results!

Kamal

Jan 17, 2013 at 9:23 PM

Hi,

 

I double checked everything you suggested and I am still having a problem. I had put the domain.com for privacy issue. But I guess it is not a big deal if I shared the full URL that I have in my code. It is: http://peoplepoweredpeace.org/add-ins/nf/adSettings.xml

Funny thing is, I download the AdRotator Monster Sample Set and tried running that with my PubCenter info and it still wouldn't work. And the Pubcenter info is correct.

I am using VS Express 2012 for WP. Could that make a difference?

 

Kamal

Coordinator
Jan 18, 2013 at 1:06 AM

It shouldn't

 

Are you running this on a device or an emulator, note that the pubcenter control will not serve ads to the emulator.

Jan 18, 2013 at 1:45 AM
Edited Jan 18, 2013 at 1:46 AM

I got it!

At frist, I tried swapping http://adrotator.apphb.com/defaultAdSettingsSilverlightLoc.xml for http://peoplepoweredpeace.org/add-ins/nf/adSettings.xml in my app and I started seeing AdDuplex ads but that's it. Ads from any other provider does not appear. This is in the emulator. As Darkside notes, pubcenter ads will not display in the emulator.

So I tried deploying to my Lumia 710 (still with  http://adrotator.apphb.com/defaultAdSettingsSilverlightLoc.xml) and I got an error message. "A first chance exception of type ‘System.UnauthorizedAccessException’ occurred in Microsoft.Phone.dll"

Digging around the interwebs, I found this: http://www.mattdavid.net/category/wp7/, which recommends running CapabilityDetection (stuff found in the WMAppManifest.xml) of the app.

Looking around further on how to do this for a WP 7.1 app in VS Express 2012 for Windows Phone I found this: http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394032(v=vs.105)

Basically, under the Project menu there is "Open Store Test Kit."  Clicking on that opens a window with three tabs on the left. Select "Automated Tests" change solution configuration from Debug to Release. Click on Run Tests and wholla! Capabilities used by application.

I had turned off a whole bunch of stuff in the WMAppManifest.xml since I didn't think I needed them. Why would I need PhoneDialer capability for showing ads? I dunno but the app and the ad control need it.

Anyway, my app shows ads with my ad config file.

 

Darkside, I did notice that debugging on the device would still crash if I used the "http://adrotator.apphb.com/defaultAdSettingsSilverlightLoc.xml " as the remote setting file.

This is what I get "An unhandled exception of type 'System.TypeInitializationException' occurred in MobFox.Ads.dll
Additional information: The type initializer for 'MobFox.Ads.AdProviders' threw an exception.

Since I am not using MobFox, my app isn't affected by it but I thought I would point it out. 

 

Thanks for making this control available and your help in getting it working for my app!

Coordinator
Jan 18, 2013 at 11:08 AM

Glad your up and running.

Yes the capabilities thing is fairly important with WP, always best to run the App/Store test kit on your app to ensure everything Is turned on.

 

As for the MobFox reference, with V1 it's required to have all the provider DLL's referenced in your project even if you aren't using them, I do find it odd your not getting an issue without it but hay ho.

In V2 were going to break that dependency along with a load of other improvements