Collapse control if no ad loaded at all?

Apr 14, 2012 at 7:45 AM

I've started testing my app in flight mode to make sure that it doesn't break if there isn't any network connectivity. I've noticed that the ad control is still on the page even if no ad is showing. This is seen most clearly in my app if there is more content to scroll than would fit on the screen.

Would it be possible for the control to automatically collapse if no ad is loaded, or do you suggest that I hook onto an event and programmatically set the visibility to collapsed if no ad loads?

Thanks.

Philip

 

Apr 14, 2012 at 7:48 AM

Just as an update to this question, one of the challenges I'm seeing here is that the white border for the control briefly appears then vanishes. Ideally I'd like to try and eliminate that but I don't know how best to achieve it, or indeed if it is something that I can resolve myself.

Thanks.

Philip

 

Coordinator
Apr 14, 2012 at 9:31 AM

The UnifiedAdControl is in its sense a ContentControl which has one or none AdControls as content. Most of the AdProviders don't give a NoAd message before being shown first.

Something that can be done is Check if there's Network connectivity and set the Visibility of the adcontrol to Collapsed in case of no visibility.

If you give the UnifiedAdControl a name like "Ad". You can use this code inside the OnNavigatedTo methods of the pages.

if (!NetworkInterface.GetIsNetworkAvailable() || NetworkInterface.NetworkInterfaceType == NetworkInterfaceType.None)
{
    Ad.Visibility = Visibility.Collapsed;
}
else
{
    Ad.Visibility = Visibility.Visible;
}

Apr 15, 2012 at 7:37 AM

Will the solution above be implemented in a future version of the control?

Coordinator
Apr 15, 2012 at 11:46 AM

Do you want a solution like above to be implemented in UnifiedAd? I am wondering if this is something you would always want, or if there are situations where you would want to try to show ads, even without connectivity. Probably it's a good approach to hide the ad when no connectivity is present. I will create a workitem.

Coordinator
Apr 15, 2012 at 12:14 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.