Search Unity

Using the Admob SDK for WP 8 in combination with Unity - Ad never OnAdReceived etc. never called

Discussion in 'Windows' started by ClaasM, Feb 7, 2015.

  1. ClaasM

    ClaasM

    Joined:
    Oct 4, 2014
    Posts:
    26
    Hey Community,

    I'm currently trying to port my Apps to Windows Phone using Admob interstitials for monetization and currently i'm having the problem that the code used in the example provided by AdMob doesn't seem to work in a WP8-project build by Unity.

    This is my Code:
    Code (CSharp):
    1. public MainPage()
    2.         {
    3.             var bridge = new UnityBridge();
    4.             UnityApp.SetBridge(bridge);
    5.             InitializeComponent();
    6.             bridge.Control = DrawingSurfaceBackground;
    7.  
    8.             loadAd();
    9.         }
    10.  
    11.         private void loadAd()
    12.         {
    13.             // NOTE: Edit "MY_AD_UNIT_ID" with your interstitial
    14.             // ad unit id.
    15.             interstitialAd = new InterstitialAd("[my correct ad-id]");
    16.             // NOTE: You can edit the event handler to do something custom here. Once the
    17.             // interstitial is received it can be shown whenever you want.
    18.             interstitialAd.ReceivedAd += OnAdReceived;
    19.             interstitialAd.FailedToReceiveAd += OnFailedToReceiveAd;
    20.             interstitialAd.DismissingOverlay += OnDismissingOverlay;
    21.             AdRequest adRequest = new AdRequest();
    22.             adRequest.ForceTesting = true;
    23.             interstitialAd.LoadAd(adRequest);
    24.  
    25.             Debug.WriteLine("loadAd finished");
    26.         }
    27.  
    28.  
    29.         private void OnAdReceived(object sender, AdEventArgs e)
    30.         {
    31.             Debug.WriteLine("Received interstitial successfully. Click 'Show Interstitial'.");
    32.             interstitialAd.ShowAd();
    33.         }
    34.  
    35.         private void OnDismissingOverlay(object sender, AdEventArgs e)
    36.         {
    37.             Debug.WriteLine("Dismissing interstitial.");
    38.         }
    39.  
    40.         private void OnFailedToReceiveAd(object sender, AdErrorEventArgs errorCode)
    41.         {
    42.             Debug.WriteLine("Failed to receive interstitial with error " + errorCode.ErrorCode);
    43.         }
    "loadAd finished" is still printed out but nothing else after that unlike in the Example project by Google which worked just fine.

    I added the Admob-Library to the References and specified the needed capabilities.

    My idea was to call a showAd-Method from within the Unity-Project that then puts the interstital above the UnityPlayer (Works great with Android).

    Any help is appreciated.
    Regards,
    ClaasM

    Edit:
    It appears to be working with this guy: http://www.deependgames.com/Blog/Post/2/AdMob-Unity-Plugin-for-Windows-Phone-8 so why doesnt it work for me :/

    Edit 2:
    Has anyone ever had success using the ScruffyFurn-Plugin for Admob-Interstitials in a Unity-Game for Windows Phone?
     
    Last edited: Feb 7, 2015
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    Is this on WP8 or WP8.1?
    We have a bug in WP8.1 where MS ad control doesn't work, because in XAML instead of creating a Frame and navigating to MainPage we simply assing MainPage as window content. You might need similat modifications.
     
  3. FlashMuller

    FlashMuller

    Joined:
    Sep 25, 2013
    Posts:
    450
    Aurimas, is there an existing discussion with solution to what you mentioned? Could you point me there?
     
  4. ClaasM

    ClaasM

    Joined:
    Oct 4, 2014
    Posts:
    26
    Sorry for answering late. Turned out doing a Master build, installing it on the device and disconnecting the device from the PC did the trick. I couldn't figure out why that helped, but it did.
     
  5. jtok4j

    jtok4j

    Joined:
    Dec 6, 2013
    Posts:
    322
    ScruffyFurn-Plugin for Admob-Interstitials <--- is really awesome, but I cannot get it to work...
    I have come to the part in the directions where it mentions:
    Open your Player Settings (File->Build Settings->Player Settings->Windows Store)
    First we need to add our plugin to the Unprocessed Plugins list, navigate to it Misc->Unprocessed Plugins

    Using Unity 5.0.0.f4 alas... I cannot see this option... ? (That is: Unprocessed Plugins doesn't actually exist as an option in the Player Settings...)