More from the AdMediator Control

Hi Guys,

I’m still working on the AdMediator Control for my app and I though I found a bug, that is more a misconfigure of the control, but I like to share it with you.

I created an Ad UnitId in the DevCenter of Microsoft with the type “Video interstitial”. My expectation was to get animated banner for my app. So I entered the new UnitId to my app and start debugging. After some refreshes (sometimes some more refreshes, sometimes the first load) my app crashed because of an UnhandledException in win32. I am catching UnhandledExceptions in my app, so I was confused. I figured out, that if I disabled “Microsoft Advertisement”-Network for my AdMediator Control, the problem was gone. So I continued testing and figured out, that the problem only exists, if compile my app in x64. If I compile my app in x86 the app don’t crashes, but I get a text in my banner called “FreeWheelFreeWheel” or “FreeWheelFreeWheelFreeWheel”.

I reported this to Microsoft and get a rapid answer (much faster than I assumed!):

Kristian, if the unit was created for video interstitials, it cannot be used in mediation or with AdControl.  The only use case for such an AdUnit is in the RequestAd method from InterstitialAd class.
That said, we should never crash, and for that behavior I’ve filed bug 4786896.
My guess is that if text “freewheel” showed up in the WebView control, it means we injected the VAST payload (meant for video ads) into the container. WebView itself, or the edge engine is probably going to show in the stack.

That is a clear and good answer! Thanks Microsoft!

Originally posted on October 1st 2015

WNS PushChannelURI is https://notificationserver.microsoft.com/…

I just wasted two hours to figure out why the PushChannelURI in my Windows Phone Emulator has a PushChannelURI that is http://notificationserver.microsoft.com/AppKey…… but usually it should be something like https://db5.notifiy.windows.com/?token=…..

When this PushChannelURI is detected and you’re trying to send something to that URI, you would get an error, that this servername is not resolvable. The answer is simple: You have the Notifications-Simulation activated in your Emulator. Disable it, reinstall the app on the Emulator and your will have a regular Channel URI for the WNS back.

Happy testing!

Originally posted on September 12th 2015

AdMediator for Windows Store Apps

Time for my first blog-post.

Update: Everything mentioned here belongs to the new DevCenter of Microsoft, but NOT to Universal Apps for Windows 8.1
Update2: I added information how to solve Error “AM007 We couldn’t add all the required references”

This week I struggled around with the Ads for Windows Store Apps. Microsoft changed the handling of it when they introduced Windows 10.
The Microsoft AdMediator-Control is the Control, that provides the Ads in .Net – as long as you don’t use another 3rd Party thing.

My problem was: I added the control and tried to configure it, like it is described on one of many pages, Microsoft has saved very fragmented in the MSDN: https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn864355.aspx.

After I added the control I saw none of the properties, that are described by Microsoft in the example. So I added it by myself. But: What is the ID-Property for? Is it something defined or is it something I can choose by myself? The last question is the correct answer. It is an ID, that is used by your app to identify the Banner. In other Words: it is a second “Name”-Property. But the difference is, that you should never change the ID of that control, because that will break all statistics Microsoft records for you. The Name-Property can be changed at any time.
The next Properties are Width and Height. You need to set them. “Auto” or “*” will not work. The AdMediator Control requires fixed values.

After I finally added the control to the Page, I had to configure the adds. That is really fiddly, but it is also described in the link above. I tried to add the Microsoft-Advertising Service and Smaato. I failed with Smaato. I restarted Visual Studio. No change. Googled a bit: nothing helpful. Finally I figured out, that the resources for the AdProviders are stored in the bin-directory. I closed Visual Studio and deleted the folder. I started Visual Studio and tried it again. It work – Thanks!
I hope now it will work.

Edit2:
After some more weeks I reorganized my projects and solutions. After I did this, my project didn’t build anymore because it cannot find the Namespace “Microsoft.AdMediator.Core.Models” anymore. I checked the references and the message was correct: My AdMediator-Assemblies were gone. Only the References for the Smaato-Provider were still present. In the “Connected Service…”-Dialog the Microsoft Advertisment network was in status “Not Fetched”. When I tried to readd it (removed and add again) I got the Error “AM007 We couldn’t add all the required references. (…)”.
First I tried the solution above, but it didn’t worked.
The final solution for me was:
1. Remove everything related to the AdMediator from your project. References, usings, XML-Namespaces in the xaml-Files, Methods, Events etc.
2. Build your project until it runs without the AdMediator
3. Close Visual Studio
4. Go the the folder were your NuGet-Packages are stored. The folder is named “packages” and is usually next to your Solution-File (*.sln). Delete everything related to the AdMediator, AdDuplex and Smaato. If you are not sure, you can also delete the whole folder, but then the missing libraries have to be downloaded again.
5. Go to your project-folder and delete the bin- and obj-folder
6. Open the package.config in your project-folder with a text-editor. If there is anything related to AdMediator, AdDuplex or Smaato, delete it.
7. Open your Solution again in Visual Studio. Go to the Designer and Drag’n’Drop the AdMediator-Control (not the “AdControl”!). The AdMediator-Control was at the bottom of the Toolbox for me.
8. Configure your control as it was before. If you just comment old control out, you can replace the Drag’n’Drop-Created code by your old one.
9. Check if your project builds (it should)
10. Right Click “References” in the Solution Explorer and select “Add” -> “Connected Service…”. Select “Ad Mediator” and click configure. There should be a “Fetched” now next to “Microsoft Advertising”.
11. Configure your “Microsoft Advertising”-Network by click on the “configure” link. If you are done, click “Add” (but it is more like “OK”).
12. Check if your project builds (it should)
13. Open the Ad Mediator configure dialog again and add the Smaato-Network. It should download the Smaato Libraries and finally results in a “Fetched” too. Don’t forget to configure Smaato after this.
14. Repair everything you destroyed in Step 1 and you are done.
15. If you change the Id of the AdMediator-Control in Step14 (or after configuring any network), you have to open the “Connected Service”-Dialog to Update this in the Ad-Config. If you not open the “Connected Service”-Dialog again, you a Debug-Output in the Output-Window like “Exception thrown: ‘System.NullReferenceException’ in Microsoft.AdMediator.Windows81.MicrosoftAdvertising.DLL”
#Edit2 End

Some more things @Microsoft:

1. Please provide something like a Quick-Start-Documentation INCLUDING the part in the Developer Dashboard. Don’t fragment it over many sites. In the fragmented ones, you can be more detailed – more that it is now!

2. Where can I control the size of the Ads you provide me in the Developer Dashboard?

3. Where can I configure what kind of Ads I like to see? I also wish a Blacklist for companies, that are offering some things to win, if I answer some questions. I don’t want them.

Originally posted on August 20th 2015