Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Tapping on ad in Windows Phone does nothing

Discussion in 'Windows' started by sotteson, Dec 6, 2014.

  1. sotteson

    sotteson

    Joined:
    Nov 29, 2014
    Posts:
    5
    (Using 4.6.0p1)

    I'm using the MS Advertising SDK, and I'm adding an AdControl in the code behind to my game. The ad shows up for both Windows and Windows Phone, but if I tap on the ad on WP nothing happens. It works as expected on Windows. Has anyone else seen this? The XAML for my SwapChainPanel looks like this:

    <SwapChainPanel x:Name="DXSwapChainPanel">
    <Grid x:Name="ExtendedSplashGrid">
    <Image x:Name="ExtendedSplashImage" Source="Assets/SplashScreen.png" VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </Grid>
    <Grid x:Name="AdGrid" Visibility="{Binding WinAdVisiblity}">
    </Grid>
    </SwapChainPanel>

    Code behind:
    AdControl ad = new AdControl();
    ad.ApplicationId = "XXX";
    ad.AdUnitId = "XXX";
    ad.Width = 300;
    ad.Height = 50;
    ad.IsAutoRefreshEnabled = true;
    ad.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
    ad.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top;
    this.AdGrid.Children.Add(ad);
     
    Last edited: Dec 6, 2014
  2. pumpkinszwan

    pumpkinszwan

    Joined:
    Feb 6, 2014
    Posts:
    214
    I don't know what the problem is, but try actually adding the ad control into the XAML instead of creating it in code behind. Maybe check if the instantiated adcontrol is capturing the tap event. Is there a property in AdControl that determines if it can be tapped or not? Some controls have a property like that which is not enabled by default.
     
  3. MasoInar

    MasoInar

    Joined:
    Feb 20, 2014
    Posts:
    125
    sotteson likes this.
  4. pumpkinszwan

    pumpkinszwan

    Joined:
    Feb 6, 2014
    Posts:
    214
  5. MasoInar

    MasoInar

    Joined:
    Feb 20, 2014
    Posts:
    125
    I tried almost everything, but didn't found any solution..
     
  6. plasticYoda

    plasticYoda

    Joined:
    Aug 20, 2013
    Posts:
    62
    I ran into the same problem & tried using the latest patch release of Unity 4.6 & 5.0 - neither resolved the issue. I posted a new thread on the forum, and got a response from someone at Unity. I did what they suggested (took a little trial & error) but I was able to make it so that the ads could be tapped on.

    http://forum.unity3d.com/threads/un...soft-adverstising-banner.317528/#post-2060788

    I'm going to post on that new thread the modifications I made to the xaml.cs code shortly.
     
  7. Indie Viking

    Indie Viking

    Joined:
    Sep 12, 2013
    Posts:
    28
    As platicYoda shows in his other thread, the AdControl requires an Frame in the XAML tree to work properly.

    The reason why the ad is not clickable without an Frame is because of this code in the onClick method in the AdControl:

    Code (csharp):
    1. if (this.applicationFrame != null)
    2. {
    3.      this.actionHandler = new ActionHandler(this.currentAd, new EventHandler(this.OnActionCompleted), this.applicationFrame);
    4.      this.applicationFrame.OrientationChanged += new EventHandler<OrientationChangedEventArgs>(this.actionHandler.OnApplicationOrientationChange);
    5.      if (this.IsEngagedChanged != null)
    6.      {
    7.           this.IsEngagedChanged(this, EventArgs.Empty);
    8.      }
    9. }
    A person from Microsoft AdSDK team writes in an old forum post about this issue, and that this is a bug in the AdSdk, and that they will fix the problem.

    Thore