Adcontrol Windows Phone does not show - c#

I have read this (similar) question: Windows phone ads not working
And I have read this blog post. But it still does not work.
I have the feeling that it has something to do with my references. Or is it that it does not show up debugging the app on my phone? (because my cpu is too old to run emulation)
my xaml:
xmlns:ads="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI"
and below:
<ads:AdControl x:Name="showMeTheMoney"
ApplicationId="a pubcenter id"
AdUnitId="a pubcenter ad unit id"
HorizontalAlignment="Left"
Height="80" Margin="0,0,0,0"
Grid.Row="1"
VerticalAlignment="Top"
Width="480"/>
in pubcenter I have registered the app and adunit and also the size (480 x 80)
But it is still a black square on my phone.
Also the manifest has the required rights:

Ads using real ApplicationId and AdUnitId are not working in emulator, for testing you should use test values located here:
Test Values for AdUnitId and ApplicationId

Related

Microsoft Ad SDK for UWP drinks memory

I've this ad control in each of my app's pages
<UI:AdControl
ApplicationId="my app id"
AdUnitId="my unit id"
Height="50"
Width="320"
ErrorOccurred="AdControl_ErrorOccurred"
IsAutoRefreshEnabled="True"
VerticalAlignment="Bottom"
HorizontalAlignment="Center"/>
After a few navigation back and forth it causes a memory leak and app crashes. as simple as that.
What can I do to avoid this? is there a way to have one instance of this control globally and use it in each page?
Thanks.

Open URL in default Web Browser. Windows Phone 8.0 app

I have a hyperlink inside a Text block. I want it to open the link int he web browser, but when I Click it I get a popup saying
"Search an app in the store"
and my app crashes.....
my XAML code is:
<TextBlock HorizontalAlignment="Right" Height="49" Margin="0,0,10,0" TextWrapping="Wrap" Width="326" Foreground="Black" FontSize="16">
<TextBlock.Inlines>
<Hyperlink Click="Hyperlink_Click" NavigateUri="www.bing.com">
<Hyperlink.Foreground>
<ImageBrush Stretch="Fill" ImageSource="Assets/Proceed.png"/>
</Hyperlink.Foreground>Don't have a Selfcare Account ? Register here.</Hyperlink>
</TextBlock.Inlines>
<!--<Hyperlink xml:space="preserve" Foreground="#000" FontSize="16">Don't have a Mobitel Selfacre Account ? Register here. </Hyperlink>-->
</TextBlock>
my CS code is:
private async void Hyperlink_Click(Windows.UI.Xaml.Documents.Hyperlink sender, Windows.UI.Xaml.Documents.HyperlinkClickEventArgs args)
{
await Launcher.LaunchUriAsync(new Uri("www.google.com"));
}
Kindly help me fix it... Any kind of help is appreciated....
Change the uri from www.bing.com to http://www.bing.com. It needs the protocol to determine the application it uses to start the url with.
Check these links for more information:
Auto-launching apps using file and URI associations for Windows Phone 8
URI schemes for launching built-in apps for Windows Phone 8
Reserved file and URI associations for Windows Phone 8

Hub / HubSection in Windows 10 Mobile

I try to migrate my Windows 8.1 application to Windows 10 Mobile (SDK 10240),
But the Hub control doesn't work like in Windows Phone 8.1.
The hub sections are too small or big and don't fit the mobile screen width.
I didn't find any property to solve the problem.
<Hub Background="White" Header="Header">
<HubSection x:Uid="HubSection1" Header="Header1">
<DataTemplate>
<TextBlock Text="Content1" />
</DataTemplate>
</HubSection>
<HubSection x:Uid="HubSection2" Header="Header2" >
<DataTemplate>
<TextBlock Text="Content2" />
</DataTemplate>
</HubSection>
</Hub>
I want it like in Windows Phone 8.1 that the Header1 is in the first page, Header2 in the second, etc...
I created this Behavior to make the Hub control behave like the Windows Phone 8.1 control when running on mobile.
Check it out and tell me if it fixes your problem.

Equivalent to adControl.HasAd in windows phone 8.0

In a Windows Phone 8.1 universal app, I could use this Code for a Pub Center ad.
//code behind:
if(adControl.HasAd)
{
}
//xaml:
<UI:AdControl x:Name="adControl" AutoRefreshIntervalInSeconds="60" ApplicationId="" AdUnitId="" HorizontalAlignment="Left" Height="70" IsAutoRefreshEnabled="True" VerticalAlignment="Top" Width="400" Foreground="Black" Background="Black"/>
But this function isn't avaible for a Silverlight App. Does someone know a equivalent to "adControl.HasAd" in a Windows Phone 8.0 App?
I don't think there is an equivalent in WP8.0. What you can do though is have your own bool and set/unset it with the following two events:
adControl.AdRefreshed:
Raised when the AdControl receives a new ad.
and
adControl.ErrorOccured:
Raised when the AdControl receives a new ad.
If you just want to collapse the advert when no ad is shown you can also use:
adControl.IsAutoCollapseEnabled = true;

How to change the theme of application if the system theme has been change in Windows Phone 7

How to change the theme of application if the system theme has been change in Windows Phone 7 if application in Runing?
The system theme applies throughout all apps. So if system them changes and you have used one of the system defined colors/ fonts, etc in your app, the app will automatically start using the new theme colors/ fonts.
So for eg: in your app, if you have:
<TextBlock x:Name="ApplicationTitle" Text="My App Title" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="Page Title" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
here "StaticResource PhoneTextNormalStyle" specifies that you are using this system defined style. Now when user changes their system theme, this will automatically change colors in your app. also.
See http://msdn.microsoft.com/en-us/library/ff769545(v=vs.92).aspx

Categories

Resources