This project is read-only.

AdRotator V2 Initialise and Log methods missing

Sep 24, 2014 at 9:04 AM
Edited Sep 24, 2014 at 11:11 AM
Hi I have just upgraded to the new AdRotator V2 and have a few questions about the changes.

Previously I would call OnPageLoaded()
            if (TrialExperienceHelper.LicenseMode == TrialExperienceHelper.LicenseModes.Trial)
                // Kick start AdRotator controls
                    // Call for AdRotator 

                    AdRot2.Visibility = Visibility.Visible;
                    AdRot2.IsEnabled = true;

                    // Register handlers for log information
                    AdRot2.Log += AdRot2_Log;
                catch (Exception ex)
                    Debug.WriteLine("AdRotators failed to invalidate! exception= " + ex.Message);
I didn't need to add any other code as I was only using AdDuplex and PubCenter. Now V2 is stable I want to add Inmobi and Smaato but I can get them to show ad's (actually no ad's are showing only black space).

I notice Invalidate takes an argument of AdRotator.Model.AdProvider but not sure what to pass it? I have tried creating ad provider objects in but with no luck, could you give an example? Also I don't see the Log method any more has it been changed?

Example of config file:
    <CultureDescriptors CultureName="en-US">
    <PubCenter AppId="ba595004-2934-4cfe-b783-XXXXXXXXXXX" SecondaryId="XXXXXX" Probability="80" AdOrder="1"/>
    <Smaato AppId="XXXXXX" SecondaryId="XXXXXX" Probability="10" AdOrder="2"/>
    <Inmobi AppId="XXXXXXX" Probability="10" AdOrder="3"/>
    <AdDuplex AppId="XXXXXX" Probability="0" AdOrder="4"/>
            RemoteSettingsLocation="My remote location"
Just one other thing Smaato ad's size is 320 x 50 but as most other providers are 480x80 would this leave a gap around the control? Is there a way to configure this at runtine or else?

If the user navigated away from the page in browser I used to call Invalidate again to refresh it!

Is it a case that I now have to create provider objects in code to initialise them?

I'm using Windows Phone 8 Silverlight :)

Many thanks

A newbie

Update: OK I've got it working, it seems that the PubCenter ad which is the first ordered in the XML config file was and still is displaying a black box. I removed the line and the others are now displaying! I thought that if an ad could not display then the next ad in-line would be displayed instead (if ordered)? Maybe I've set it up incorrectly?

Sep 24, 2014 at 8:01 PM
Ok, firs point :D, We've moved support of AdRotator over to GitHub now, here:

but anyway, in response to your queries:

1: Invalidate - You can call invalidate with either "null" which auto selects a provider, or by passing an AdType to select a provider by default (will fall back after that)
2: In your XAML you have "AutoStart" enabled. With this option Ads will start automatically and calling invalidate is not required. However I note you are only enabling it when in trial mode, I'd suggest dropping the AutoStart parameter (or turning it off) and using your code above.
We do have a backlog item for "only in trial mode" but it's not there yet.
3: If pubcenter is displaying a lack box it probably means the control has an issue or thinks it's getting an ad. So either take PubCentre out of rotation or do some testing separately with pubcenter on its own without AdRotator using your AppID's to check you are getting ads (may just not be being filled). Also note PubCenter generally doesn't work in the emulator.

Nice to see you testing the new AdOrder functionality :D
Sep 24, 2014 at 8:05 PM
As always, many thanks :)