Show GenericAdProvider when no internet connection

Apr 19, 2012 at 1:06 PM

Hi Mark,

I'm not sure if this is possible already (Read through your docs, but didnt see anything), but I was wondering if the GenericAdProvider could be shown when there is no internet activity at all (Provided you have the Offline Content specified). This way you can still show/promote your other apps when there is no internet connection, instead of it just being blank.

Just a thought...

Regards,
Mauro 

Apr 19, 2012 at 1:17 PM

Hi Mauro,

You can for example put the GenericAdProvider as the only Adprovider in your local configuration.

Further more when the remote config get's cached that will get priority over the local configuration which will then be ignored. So when rotating AdProviders that are listed in the remote configuration it will randomly choose an adprovider in the list of adproviders that have "NoAdCount" to Min of NoAdCount.

So it's possible but not completely. Maybe the feature request that's open right now http://wpunifiedad.codeplex.com/workitem/601 could be combined with this.

So a configuration that could result in:

NoConnectivity

 - Hide
 - AdProviderToShow

Connectivity

 - Normal rotation 

However keep in mind, if your local ad it's intend is to have the user click, what should it do? There's no network connectivity...

Best,

Mark Monster

Apr 19, 2012 at 1:57 PM

Hey Mark,

First prize would be to be able to specify this via some configuration, but I never thought about having the Local Ad XML just containing the GenericAdProvider. That would work as well :)

With regards to clicking, I understand you wont be able to navigate anywhere, but at least you could get some visibility of your other apps to the user and then they can maybe become familiar with them.

Regards,
Mauro 

 

May 10, 2012 at 12:46 PM

Hi Mark,

I was busy trying out your solution with the Local XML file just specifying the GenericAdProviderForXaml so that that add will show when there is no internet connection.

This is what my config looks like

<AdCountryDescriptor InitialAdProvider="GenericAdProviderForXaml">
<Probability Value="100" AdProvider="GenericAdProviderForXaml" />
</AdCountryDescriptor>

This works just fine, but I see that the memory never gets released when I do that (IE. None of the finalizers are ever called). If I change the config above to MobFox, the memory is released a little later (As you mentioned due to the WeakReferences)

I think that there might just be a small issue GenericAdProviderForXaml and the memory usage

Thanks again :)

Regards,
Mauro 

			
		

May 10, 2012 at 12:50 PM

I will look into that. Can you show what you have as Xaml configured in the GenericProvider?

May 10, 2012 at 1:14 PM

Hey Mark,

Here is the XAML I'm using...

 

<Provider:GenericAdProviderForXaml XamlUri="">
                <Provider:GenericAdProviderForXaml.OfflineContent>
                    <Grid Width="480"
                          Height="80"
                          Background="{StaticResource PhoneBackgroundBrush}">
                        <Border BorderBrush="{StaticResource PhoneForegroundBrush}"
                                BorderThickness="1">
                            <Grid>
                                <HyperlinkButton HorizontalAlignment="Stretch"
                                                 VerticalAlignment="Stretch"
                                                 NavigateUri="marketplace://review" />

                                <StackPanel>
                                    <TextBlock FontFamily="{StaticResource PhoneFontFamilySemiBold}"
                                               Style="{StaticResource PhoneTextNormalStyle}"
                                               Text="MyTitle"
                                               TextAlignment="Center" />

                                    <TextBlock Foreground="{StaticResource PhoneDisabledBrush}"
                                               Style="{StaticResource PhoneTextSmallStyle}"
                                               Text="Info"
                                               TextAlignment="Center"
                                               TextWrapping="Wrap" />
                                </StackPanel>
                            </Grid>
                        </Border>
                    </Grid>
                </Provider:GenericAdProviderForXaml.OfflineContent>
            </Provider:GenericAdProviderForXaml>

Thanks very much
Regards,
Mauro 

May 16, 2012 at 9:26 AM

Hi Mark,

I was busy doing some testing and I saw this very strange behaviour. If there is No Ad to be shown, it seems that the Control keeps on retying to get another ad and is stuck is a loop. It causes my UI to get extremely sluggish when this happens. I added a Debug.WriteLine to the NoAd event as well to make sure.

Here is a small section of the output from the debug window (These outputs happen quite often say about every 1-2 seconds???)

 

WPUnifiedAd - Chosen adprovider: MobFox
WPUnifiedAd - Chosen adprovider: MobFox
No Ad
No Ad
WPUnifiedAd - Chosen adprovider: MobFox
No Ad
WPUnifiedAd - Chosen adprovider: MobFox
No Ad
WPUnifiedAd - Chosen adprovider: MobFox
No Ad
WPUnifiedAd - Chosen adprovider: MobFox
No Ad
WPUnifiedAd - Chosen adprovider: MobFox
No Ad
No Ad
WPUnifiedAd - Chosen adprovider: MobFox
No Ad
WPUnifiedAd - Chosen adprovider: MobFox
No Ad
WPUnifiedAd - Chosen adprovider: MobFox
No Ad
WPUnifiedAd - Chosen adprovider: MobFox
No Ad
WPUnifiedAd - Chosen adprovider: MobFox
A first chance exception of type 'System.Net.WebException' occurred in System.Windows.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Windows.dll
A first chance exception of type 'System.IndexOutOfRangeException' occurred in mscorlib.dll
A first chance exception of type 'System.IndexOutOfRangeException' occurred in mscorlib.dll
A first chance exception of type 'System.ArgumentNullException' occurred in mscorlib.dll
No Ad
No Ad
WPUnifiedAd - Chosen adprovider: MobFox
No Ad
WPUnifiedAd - Chosen adprovider: MobFox
No Ad
WPUnifiedAd - Chosen adprovider: MobFox
No Ad
No Ad
WPUnifiedAd - Chosen adprovider: MobFox
WPUnifiedAd - Chosen adprovider: MobFox
No Ad
No Ad
WPUnifiedAd - Chosen adprovider: MobFox
WPUnifiedAd - Chosen adprovider: MobFox
No Ad
No Ad
WPUnifiedAd - Chosen adprovider: MobFox
WPUnifiedAd - Chosen adprovider: MobFox
No Ad
No Ad
WPUnifiedAd - Chosen adprovider: MobFox
No Ad
WPUnifiedAd - Chosen adprovider: MobFox
No Ad

Here are my settings for the various items

 <Ads:AdControl.AdProviderStrategy>
            <Strategy:RemoteAdProviderStrategy xmlns:Strategy="clr-namespace:MC.Phone.Ads.Strategy;assembly=MC.Phone.Ads"
                                               LocalProviderSettingsUri="[AssemblyHere]LocalAdSettings.xml"
                                               RemoteProviderSettingsUri="http://server/RemoteAdSettings.xml" />
        </Ads:AdControl.AdProviderStrategy>

The Local Ad just has the following:
<AdCountryDescriptor InitialAdProvider="GenericAdProviderForXaml">
			<Probability Value="100" AdProvider="GenericAdProviderForXaml" />
		</AdCountryDescriptor>

And the remote has the following:
<AdCountryDescriptor InitialAdProvider="MobFox">
			<Probability Value="100" AdProvider="MobFox" />			 
		</AdCountryDescriptor>

Also, it seems that Version 1.1 on NuGet is a debug build...as I'm seeing the Debug.Writeline's from the Ad control :)

Regards,
Mauro 

May 23, 2012 at 7:30 AM

Hi Mark,


Just wondering if you were able to reproduce the issue with the mutliple calls to choosing an AdProvider?

 

Thanks very much

Regards,
Mauro