Microsoft 广告单元 - 设备系列 [英] Microsoft advertising ad units - Device family

查看:31
本文介绍了Microsoft 广告单元 - 设备系列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 uwp 应用程序,我完成了它并准备通过开发中心在商店中提交我的应用程序.我的应用程序有 AdControl 广告,通过 VisualStateManager

I'm developing a uwp app, and I finished it and was preparing to submit my app in the store, through the dev center. My application has AdControl advertising, which is presented in the desktop version (Windows 10) and the mobile version (Windows 10 Mobile) through VisualStateManager

在桌面版本中,我有:

<Setter Target="Ad.Height" Value="90"/>
<Setter Target="Ad.Width" Value="728"/>

在移动版本中,我有:

<Setter Target="Ad.Height" Value="50"/>
<Setter Target="Ad.Width" Value="320"/>

即横幅的大小适应不同的屏幕尺寸.

That is, the size of the banner adapts to the different screen sizes.

我的问题是:在开发中心的Microsoft 广告单元"中,我必须选择一个设备系列.我该怎么做?我是否必须生成 PC/平板电脑 ID 和手机 ID?然后我如何在我的代码中做到这一点?我只有一个只接受一个 ID 的广告控件

My question is: In Dev Center, in "Microsoft advertising ad units" I have to choose a Device family. How do I do it? Do I have to generate a PC / tablet ID and a mobile ID? And then how do I do this in my code? I only have one ad control that accepts only one ID

推荐答案

在开发中心的微软广告单元"中,我必须选择一个设备系列.我该怎么做?

In Dev Center, in "Microsoft advertising ad units" I have to choose a Device family. How do I do it?

您需要选择要展示广告的设备类型,然后点击创建广告单元"即可生成广告.稍后您将在代码中使用这些值.

You need to select the device type on which you want to show ads and just click "Create ad unit" to generate them. And later you will use these values in your code.

对于横幅广告:https://docs.microsoft.com/en-us/windows/uwp/monetize/adcontrol-in-xaml-and--net

对于插页式广告(视频):https://docs.microsoft.com/en-us/windows/uwp/monetize/interstitial-ads

For interstitial ads(for video):https://docs.microsoft.com/en-us/windows/uwp/monetize/interstitial-ads

我是否必须生成 PC/平板电脑 ID 和手机 ID?

Do I have to generate a PC / tablet ID and a mobile ID?

是的,强烈建议这样做.

Yes, it's highly recommended to do it.

然后我如何在我的代码中做到这一点?我只有一个广告控件只接受一个 ID

And then how do I do this in my code? I only have one ad control that accepts only one ID

要创建 Ad Control 以显示两种设备系列类型的广告,您可以按照 文档:

To create Ad Control to display the ads for both device family type, you can follow the code in the documentation:

// Declare an AdControl.
private AdControl myAdControl = null;

// Application ID and ad unit ID values for Microsoft advertising. By default,
// assign these to non-mobile ad unit info.
private string myAppId = DESKTOPAPPLICATIONID;
private string myAdUnitId = DESKTOPADUNITID;
Add the following code to your Page class constructor, after the call to the InitializeComponent() method.



myAdGrid.Width = AD_WIDTH;
myAdGrid.Height = AD_HEIGHT;

// For mobile device families, use the mobile ad unit info.
if ("Windows.Mobile" == AnalyticsInfo.VersionInfo.DeviceFamily)
{
    myAppId = MOBILEAPPLICATIONID;
    myAdUnitId = MOBILEADUNITID;
}

// Initialize the AdControl.
myAdControl = new AdControl();
myAdControl.ApplicationId = myAppId;
myAdControl.AdUnitId = myAdUnitId;
myAdControl.Width = AD_WIDTH;
myAdControl.Height = AD_HEIGHT;
myAdControl.IsAutoRefreshEnabled = true;

myAdGrid.Children.Add(myAdControl); 

这篇关于Microsoft 广告单元 - 设备系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆