Control never initialized

Dec 17, 2012 at 5:15 PM

Hi,

Got WP8 version of the control. I can't call Invalidate() in Page_Loaded as the control in not initialized. 

Note: I have this working on 7.5 with the old version and when I put XAML in for the ad sdk's seperately I can gets ads to display for both Adduplex and Microsoft Pubcenter in the emulator. All necessary capabilities are set as far as I know.

My setup:

Installed the AdRotater through Nuget.

Installed Adduplex WP8 version through Nuget (AdDuplex.WindowsPhone V2.8.0.3)

Installed MS Advertising SDK through Nuget (Microsoft Advertising SDK for Windows Phone 8 (XAML) V6.1.0.0)

All of the above are the latest packages available. All other Ad SDK's was installed with Adrotator.

My XAML:

<AdRotatorWin8:AdRotatorControl x:Name="AdRotator" Width="480" Height="80" xmlns:AdRotatorWin8="clr-namespace:AdRotator;assembly=AdRotator" 
                            DefaultSettingsFileUri="/MyProject;component/AdRotator/DefaultAdSettings.xml"
                            DefaultAdType="AdDuplex"
                            PubCenterAdUnitId="11111111" PubCenterAppId="f9bf5f77-38dd-35c4-98df-f8636c401755"
                            AdDuplexAppId="2199" />

Code Behind:

private void Page_Loaded(object sender, RoutedEventArgs e)
{
    if (AdRotator.IsInitialised)
    {
        AdRotator.Invalidate();
     }
}

DefaultAdSettings.xml:

 

<?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="50" AdType="PubCenter" AppID="f9bf5f77-38dd-35c4-98df-f8636c401755" SecondaryID="10045176" />
        <Probabilities Probability="50" AdType="AdDuplex" AppID="2199"/>
    </AdCultureDescriptor>
    <AdCultureDescriptor CultureName="en-GB">
        <Probabilities Probability="50" AdType="PubCenter" AppID="f9bf5f77-38dd-35c4-98df-f8636c401755" SecondaryID="10045176" />
        <Probabilities Probability="50" AdType="AdDuplex" AppID="2199"/>
    </AdCultureDescriptor>
    <AdCultureDescriptor CultureName="default"> 
      <Probabilities Probability="50" AdType="PubCenter" AppID="f9bf5f77-38dd-35c4-98df-f8636c401755" SecondaryID="10045176" />
      <Probabilities Probability="50" AdType="AdDuplex" AppID="2199"/> 
    </AdCultureDescriptor> 
  </CultureDescriptors> 
</AdSettings>

Why does my Adrotator Control not initialize. Am doing something wrong or am I using the wrong version of either MS Ad SDK or Adduplex?

Thank you.

Coordinator
Dec 17, 2012 at 6:05 PM

We did have a note from one user that the defaultadsettings file in the NuGet package has the wrong build type.

should be set to "Resource" not Content

hope that helps.

also suggest hosting the config file online using either Azure web sites or appharbour for free

Dec 17, 2012 at 8:22 PM

My defaultAdSettings.xml file is the set to BuildType "Resource".

Are the versions for the Ad SDK's I'm using correnct? AdDuplex.WindowsPhone V2.8.0.3 and Microsoft Advertising SDK for Windows Phone 8 (XAML) V6.1.0.0?

 

Dec 17, 2012 at 9:09 PM

Also another thing I noticed. In my WP 7.5 version there is a reference to MobFox.Ads. In the new version once installed from NuGet there is not such reference. Is this missing or just removed and I shouldn't worry about it?

Coordinator
Dec 18, 2012 at 2:49 PM

Right, just tested and your issue is that you are checking the "IsInitialised" flag on the adrotator control in your loaded event.

We removed the need to test this in the latest releases. Just call "Invalidate" in your loaded event and it will work fine.

 

Also, I noted in your example above, you are setting the publisher ID's twice, once in the XAML and once in the Configuration XML.  best to only do this once so EITHER set it in the configuration xml (recommended) or in the XAML.

Coordinator
Dec 18, 2012 at 2:54 PM

Oh and regards MobFox, MobFox and AdMob are not supported naively on WP8 so they have been desupported.  We may bring them back later using our WebAPI interface later if there is demand for them.

Dec 18, 2012 at 3:21 PM

Sweet. Got it working now. 

Thanks a lot for the help and replying to all my questions.