I am develop an uwp app (Windows 10) with ads (banner). In Windows Dev Center have an option in ads section: Device Family: UWP (Windows 10). The id generated in this section Works in all uwp apps, in Windows 10 Desktop, Windows 10 Mobile and Xbox? That is, I just need a single id (and adapt the banner size to each device) and it works for all types of devices (Desktop, Tablet, Mobile and Xbox)?
1 Answers
The id generated in this section Works in all uwp apps, in Windows 10 Desktop, Windows 10 Mobile and Xbox?
Yes. Currently, the available option in Dashboard is UWP (Windows 10), PC/Tablet (Windows 8.1), or Mobile (Windows Phone 8.x). For UWP apps, the id works for all the device family that your package targets on.
You might refer to Set up ad units in your app.
That is, I just need a single id (and adapt the banner size to each device) and it works for all types of devices (Desktop, Tablet, Mobile and Xbox)?
Yes, you just need the single id for your single app. And we recommend you to adapt the banner ad to different size for different device family based on Supported banner ad sizes.
You can judge the device family using EasClientDeviceInfomation class:
private void CreateAdControl_Click(object sender, RoutedEventArgs e)
{
var adControl = new AdControl();
var clientDeviceInformation = new EasClientDeviceInformation();
var operatingSystem = clientDeviceInformation.OperatingSystem;
var button = (Button)sender;
button.IsEnabled = false;
adcontrol.ApplicationId = "3f83fe91-d6be-434d-a0ae-7351c5a997f1";
adcontrol.AdUnitId = "test";
if (operatingSystem.Equals("WINDOWS"))
{
adcontrol.Width = 300;
adcontrol.Height = 250;
}
else
{
adcontrol.Width = 300;
adcontrol.Height = 50;
}
adcontrol.ErrorOccurred += Adcontrol_ErrorOccurred;
adcontrol.AdRefreshed += Adcontrol_AdRefreshed;
var parent = (Panel)button.Parent;
parent.Children.Add(adcontrol);
}

- 1,769
- 1
- 8
- 10
-
Thank you very much! Just a small question, according to your example, the ApplicationId and AdUnitId of `if (operatingSystem.Equals ("WINDOWS"))` will be the same ApplicationId and AdUnitId of else right? – Fernando Sousa May 09 '17 at 11:01
-
@FernandoSousa Yes, I have modified the example. – Zhendong Wu - MSFT May 10 '17 at 05:47