Poor Performance on slow connection solution

Aug 21, 2012 at 5:49 AM

Hi Mark,

I'm not sure if you recall, but a while ago I mentioned that a slow or poor internet connection could cause a lockup of the UI when using the WPUnifiedAd Control. I have done some investigation into this and I came across the following post, which describes the exact problem that I'm seeing :


What I found particularly intersting was that the call to NetworkInterfaceType is done on the UI Thread, unless otherwise specified, and as such could lock up the UI for some time. I went through the source code and I saw that the NetworkHelper class makes a call to the NetworkInterfaceType, which I believe could possibly be causing this lockup.

I removed the call so it essentially looks as follows : 


		return NetworkInterface.GetIsNetworkAvailable();

After performing some testing on my applications, it seems to have eliminated the UI Lockups that I was describing. What I was wondering is there any particular reason for the NetworkInterfaceType call or could it be removed as the GetIsNetworkAvailable method should be sufficient in determining if there is a valid network connection?

Thanks very much :)



Aug 22, 2012 at 7:27 PM

Interesting thought Mauro!

Currently reading this article about it: http://cisforcoder.wordpress.com/2010/11/27/better-way-to-check-for-an-internet-connection-on-wp7/




Mark Monster

Aug 29, 2012 at 11:19 PM

Hi Mauro, Mark,

I'm developing an app that is due to be released very soon. As soon as I decided to include ad support I integrated your ad control as it looked easy to use, and had better functionality and extensibility than the other solutions.

 I also had the UI hanging issue when my device had poor network connectivity. Usually on my daily commute to work on the train. The hanging of the UI thread was anywhere between 5 seconds to 20 seconds or more. At home when connected to Wi-Fi, no issue. In locations where the mobile signal was good, again no real issue.

In poor network areas, like on the train, my app basically became unusable, and I would not have been able to release my app in that state. So was seriously considering removing the ad control and looking for another solution. I've been chatting to Mauro previously, and have implemented his source code change in a local build of your ad control, and I can confirm that it fixes the UI hanging issue.

As far as I can tell, there are no negative side effects. I get ads delivered, and when an ad provider cannot provider an ad, the control moves onto the next provider as it should.

Please can you integrate Mauro's change into your main source, as it really will benefit all users of your ad control.

Many Thanks Mark,

Keep up the good work :-)