Adding Microsoft PubCenter Ads with AdDuplex fall-back on Windows Phone 8

DVLUP has a challenge Shamelessly promote your apps with AdDuplex. AdDuplex doesn’t earn you any income so why would you want to give ads to your users without any benefit to yourself? AdDuplex answers this succinctly “According to reports the average fill rate in mobile ad networks could be as low as 10%. AdDuplex helps you utilize 100% of your ad space, so even when you are not making money from the other ad network you get free promotion for your app.”

It is encouraged to use an ad network with fallback to AdDuplex and It only takes 5 minutes to add to your app.

  1. Add references to Microsoft Advertising and AdDuplex
    a. Install Microsoft Advertising SDK, if not already, and add reference
    Reference to Microsoft Advertising SDK
    b. Install AdDuplex via NuGet Package. Enter into the Package Manager Console:
    Install-Package AdDuplexWP8
  2. Add references to the namespace in your Xaml page you want to display the ads

    xmlns:ad="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI"
    xmlns:adduplex="clr-namespace:AdDuplex;assembly=AdDuplex.WindowsPhone"
  3. Add controls so that the AdDuplex banner is under the Microsoft Advertising banner.  
    <adduplex:AdControl x:Name="adDuplexAd" AppId="12345" VerticalAlignment="Bottom" />
    <ad:AdControl Name="photoFoodDiaryAdControlRecordPage" Width="480" Height="80" VerticalAlignment="Bottom"
            IsAutoRefreshEnabled="True" IsAutoCollapseEnabled="True" 
            ApplicationId="test_client" AdUnitId="Image480_80" />

    AdDuplex requires that the complete banner is not hidden. With this setup, if the Microsoft Advertising banner fails to get an ad the IsAutoCollapseEnable will set Visibility Collapsed showing the AdDuplex banner.

  4. Generate Ad ids

    a. In WP Dev Center publish or update. Add in-app advertising and Generate ad unit ID. 
    Add in-app advertising

    b. Sign up to Ad Duplex if you haven’t and add a new App.

    AdDuplex New app

  5. Add the required capabilities to your WMAppManifest.xml

    Capabilities
  6. Since the ad network doesn’t always return an ad, to test your ads check for any errors occuring, and set the ApplicationId and AdUnitId to the test values from here. Simple add a break point in the method and inspect e.Error.Message if the break point is hit.

    ErrorOccurred="AdControlRecordPage_ErrorOccurred"
    private void AdControlRecordPage_ErrorOccurred(object sender, Microsoft.Advertising.AdErrorEventArgs e)
    {
    }

    e.Error.Message

Now you should see the Microsoft test ad. Remember to switch you ApplicationId and AdUnitId back to what you got from the Dev Center and you are done.

Microsoft Test Ad

Technorati Tags:
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s