【问题标题】:Ads ID - UWP (Windows 10)广告 ID - UWP (Windows 10)
【发布时间】:2017-10-06 09:54:50
【问题描述】:

我正在开发一个带有广告(横幅)的 uwp 应用程序(Windows 10)。在 Windows 开发中心的广告部分有一个选项:设备系列:UWP (Windows 10)。本节中生成的 id 适用于所有 uwp 应用程序、Windows 10 桌面版、Windows 10 移动版和 Xbox? 也就是说,我只需要一个 id(并根据每个设备调整横幅大小),它适用于所有类型的设备(台式机、平板电脑、移动设备和 Xbox)?

【问题讨论】:

    标签: uwp windows-10 windows-dev-center


    【解决方案1】:

    本节中生成的 id 适用于 Windows 10 中的所有 uwp 应用程序 台式机、Windows 10 移动版和 Xbox?

    是的。目前,Dashboard 中的可用选项是 UWP (Windows 10)、PC/Tablet (Windows 8.1) 或 Mobile (Windows Phone 8.x)。对于 UWP 应用,该 ID 适用于您的包所针对的所有设备系列。

    您可以参考Set up ad units in your app

    也就是说,我只需要一个 id(并将横幅大小调整为每个 设备),它适用于所有类型的设备(台式机、平板电脑、移动设备) 和 Xbox)?

    是的,您只需要单个应用程序的单个 id。我们建议您根据 Supported banner ad sizes 为不同的设备系列调整横幅广告的大小。

    您可以使用EasClientDeviceInfomation类来判断设备系列:

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

    【讨论】:

    • 非常感谢!只是一个小问题,根据您的示例,if (operatingSystem.Equals ("WINDOWS")) 的 ApplicationId 和 AdUnitId 将与 else 的 ApplicationId 和 AdUnitId 相同,对吧?
    • @FernandoSousa 是的,我已经修改了示例。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-06-10
    • 1970-01-01
    • 2016-10-12
    • 2018-01-31
    • 2018-10-20
    • 1970-01-01
    • 2017-02-17
    相关资源
    最近更新 更多