PubCenter ads

Monkey Targets Forums/Windows 8/PubCenter ads

SLotman(Posted 2013) [#1]
Taking the latest monkey release (v75a) has anyone actually got PubCenter to work on it?

All followed the tutorial (both the one that drags the control into the view, and the one doing it by code) without much success.

I can actually see a small border where the ad should be, but it goes away pretty fast, and then I've got this on the output console:



Google didn't have anything helpful about that :(

It isn't an emulator problem, since it happens the same way on a real device (yup, I've got a Lumia 620!) and it happens both with the 'test ad' and with 'real ads'... so I'm not sure what to do next.

I even reinstalled the win phone 8 sdk, hoping it would fix something... but nope, same errors :(

Have anyone succeeded on this?


SLotman(Posted 2013) [#2]
Figured it out! Apparently it was a no internet connection problem - the moment I tested on the real device, with wifi connected, the test ad showed up!

Now I only need to figure out *how* to hide/show the ads during the game... have no clue how from 'MonkeyGame.cpp' I'm going to reach the ad on MainPage.xaml :(


SLotman(Posted 2013) [#3]
Nobody has any idea how to show/hide the xaml view from within the monkey code? Not even from the c++ code?


Xaron(Posted 2013) [#4]
Not yet, will check it sooner or later. ;)

Could you post your code/changes you did to display pubcenter ads for WP8 phones please?


SLotman(Posted 2013) [#5]
It's nothing on Monkey side... I just followed the tutorial on Pubcenter side, on Visual Studio, to get it to display. I was hoping to get some way to show/hide the ads, and then I would build a custom target or something in Monkey with the necessary code.

But since I didn't get very far and was even discouraged by some sites I found saying the way the game is built there is no access to the XAML from C++ code - I never did anything on the monkey-side of things.


SLotman(Posted 2014) [#6]
Just for reference, this is the tutorial I followed: http://msdn.microsoft.com/en-us/library/advertising-mobile-windows-phone-8-adcontrol-visual-designer%28v=msads.20%29.aspx

Edit: I still can't see live ads =(
The test ads show fine both on emulator and on real device - but after I replaced the test info with my app id and ad unit id... nothing. :(


Shockblast(Posted 2014) [#7]
Hey Slotman, I also have no ads showing up problem I added an error eventhandler to it, it said that no ads are available. So that is most likely it, if the test ad shows up then I think the code should be correctly implemented.

If there is no ad, the Adcontrol view disappears from the screen but I am noticing that it still tries to get an ad every once in a while. I take that it will appear again if an ad has been correctly fetched. I haven't checked the showing and hiding of the banner yet though... But I am guessing you can just add and remove the Adcontrol from view.


Shockblast(Posted 2014) [#8]
Showing and Hiding the banner will be a bit difficult to do. Monkey outputs WP8 code in C++ but the AdControl class is in C#. So you need to call a C# method from your C++ code. I could not find an answer by googling around, I hope you guys have a bit more luck than me.

I also looked at Marks in-app purchases code but that one is also written in C++.


SLotman(Posted 2014) [#9]
Yeah, I'm not even counting on hiding/showing the ad (I also tried to implement it, but failed). My latest game (When Pigs Fly) have an "ad space" in the screen bottom all the time, exactly because of that.

I do think the problem is indeed a lack of ads to show - I get an error every minute in the console (close to the 60 secs. the ad refreshes), so it must be trying to fetch ads. I'll try to dig a contact email in pubcenter and see if I can get any help with this.


SLotman(Posted 2014) [#10]
Just to register - I've confirmed somehow (still waiting on an answer on behalf of pubcenter) that I'm not seeing ads because there is no "ad available". To do so, I first included this on top of MainPage.xaml.cs:
using System.Diagnostics;


Then, on the same file, after "InitializeComponent();" I added:
adControl.ErrorOccurred += AdUnit_ErrorOccurred;

"adControl" being the name I gave the control I dragged into the MainPage.xaml view.
And lastly, I implemented the function "AdUnit_ErrorOccurred":

        private void AdUnit_ErrorOccurred(object sender, Microsoft.Advertising.AdErrorEventArgs e)
        {
            Debug.WriteLine(">> " + e.ErrorCode.ToString());
            Debug.WriteLine(">> " + e.Error.ToString());
        }


And this is the output I've got:
>> ServerSideError
>> Microsoft.Advertising.Shared.AdException: No ad available.
   at Microsoft.Advertising.Shared.AdvertisementFactory.CreateFromResponse(String response, AdDownloadCompleteCallback adDownloadCompleteCallback)
   at Microsoft.Advertising.Shared.AdPlacement.CreateAdvertisement(Byte[] bytes)
   at Microsoft.Advertising.Shared.AdPlacement.AdRequestComplete(IWebRequestWrapper request)



SLotman(Posted 2014) [#11]
Great... just received a reply from Microsoft, that unless the app is already in the store, ads may never show up during development!

You can't imagine how happy am I to hear this... =P~