2017-05-08 4 views
0

広告(バナー)を使用してuwpアプリケーション(Windows 10)を開発しています。 Windows Dev Centerでは、広告セクションにオプションがあります:デバイスファミリ:UWP(Windows 10)。このセクションで生成されたIDは、Windows 10 Desktop、Windows 10 Mobile、Xboxのすべてのuwpアプリケーションで動作しますか? つまり、私はちょうど1つのid(各デバイスにバナーサイズを適合させる)が必要で、すべてのタイプのデバイス(デスクトップ、タブレット、モバイル、Xbox)に対応していますか?広告ID - UWP(Windows 10)

答えて

1

このセクションで生成されたID Windows 10のすべてのuwpアプリケーションで動作します デスクトップ、Windows Mobile、Xbox?

はい。現在、ダッシュボードで使用できるオプションは、UWP(Windows 10)、PC /タブレット(Windows 8.1)、またはモバイル(Windows Phone 8.x)です。 UWPアプリケーションの場合、IDはパッケージが対象とするすべてのデバイスファミリで機能します。

Set up ad units in your appを参照してください。ある

、私は1つだけのIDが必要です(各 デバイスへのバナーサイズを適応させる)、それはデバイス(デスクトップ、タブレット、モバイル とXbox)のすべてのタイプのために働きますか?

はい、1つのアプリに1つの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); 


     } 
+0

はどうもありがとうございました!あなたの例によれば、if(operatingSystem.Equals( "WINDOWS"))のApplicationIdとAdUnitIdは、他のApplicationIdとAdUnitIdと同じになりますか? –

+0

@FernandoSousaはい、私は例を変更しました。 –

+0

ありがとうございます! –

関連する問題