PC /平板电脑ID和移动ID - Microsoft广告广告单元

时间:2017-04-07 12:26:23

标签: c# xaml uwp uwp-xaml

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

在桌面版(Windows 10)和移动版(Windows 10 Mobile)中展示

我的AdControl :(示例)

<UI:AdControl ApplicationId="d25517cb-12d4-4699-8bdc-52040c712cab"
         AdUnitId="test"
         HorizontalAlignment="Left"
         Height="250"
         VerticalAlignment="Top"
         Width="300"/>

在我的桌面版中:

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

在移动版中我有:

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

也就是说,横幅的大小适应不同的屏幕尺寸。

我也有这个:

// 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 = WAPPLICATIONID;
private string myAdUnitId = WADUNITID;
Add the following code to your Page class constructor, after the call to the InitializeComponent() method.

Copy
C#
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 = MAPPLICATIONID;
    myAdUnitId = MADUNITID;
}

// 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); 

我的主页上只有一个广告,我在哪里放置PC /平板电脑ID和手机ID? 我必须创建两个AdControl吗? (每个设备系列一个)

0 个答案:

没有答案