Monday 2 December 2013

ADTECH and Windows Phone

Recently I had a requirement to integrate ADTECH banner and interstitial ads in a Windows Phone 8 app.  Like it or not, mobile advertising is here to stay; and I suppose ADTECH is as good as the next.

To their credit, ADTECH have published a Windows Phone SDK which makes integration relatively painless.  If you've done much third-party integration you have to appreciate when a vendor releases a SDK for your platform.

Unfortunately, with the WP SDK ADTECH has decided to give us a wrapper around the WebBrowser control, which smacks of "quick n dirty".  So, for my current requirements, it meant that I would have to accommodate the overhead of a WebBrowser control on nearly every page.

Personally, I avoid using the WebBrowser control and instead use a custom set of RichText controls and the HTML Agility Pack.  This gives me complete control over the rendering of my HTML, by converting HTML objects into native WPF controls, allowing me to render HTML without the overhead (and memory leaks) of the WebBrowser control.

If we take a look at what ADTECH is doing behind the scene, you can have a look at your app's IsolatedStorage using a tool like Windows Phone Power Tools.  Here we can see ADTECH getting busy by downloading individual banner ads, which effectively amounts to an HTML page and accompanying JavaScript files.


Let's face it, displaying a banner ad is not rocket science, nor should it require the use of a WebBrowser control.  All we really want to do is display an image (with or without animation) and respond to a user Tap event.  Use of the WebBrowser control to accomplish this seems a bit overkill in my opinion.

None of this would be worth writing about if it were not for the unexpected impact this had on the app and the UX.  Empirically, I have found a significant degradation in app performance once the ADTECH controls have been included in the app.  What's worse is that the inherit problems with the memory leaks associated with the WebBrowser control as detailed here, raise their ugly head in the ADTECH controls.  The net effect is eventually your app will reach its memory limit threshold and crash.