Registering the banner click and screen change problem

Jan 22, 2014 at 10:44 AM
Hey there,

I have been trying to implement your rotator into an WP7 XNA app recently and stumbled upon a little problem, namely:

The app is supposed to hide ads after the user clicks them, so that they do not disturb them anymore and so on. While it was an easy thing to do with e.g. the PubCenter SDK alone, by binding the onEngaged method, I am having trouble with doing the same with the AdRotator. Any suggestions?

What I thought of was an overlay, which would both activate the ad blockade and do the banner-clicked stuff. However, again, I have no method within the Rotator which I could tell the overlay to activate on click.

Also, there is another problem - the banner won't display on any screens beyond the first. The idea was to initialize it once, on startup, and then show it on the chosen scenes, which is the right way according to the documentation. It does exist and is perfectly clickable, but completely invisible. Any suggestions there?

Thanks in advance for any help!

P.S. I am aware that such ad-blocking mechanism should not be incentivised, it is not :-)
Jan 22, 2014 at 3:43 PM

The AdClick one in an interesting thing. We do expose an AdClick method so you can detect the Ad click event but we don't override the native behaviour of the ad control it'self. So once you click it lets the ad provider do what it does to register a click.
If you wanted to hide the ad following this click you could do it through the AdClick event.

As for the multiple page issue, we have seen this before and it's just your use of the control. Check the monster sample pack for the latest samples and one of the XNA one's in there (I think) covers multiple pages. I use multiple pages in the published sample apps on the store from my blog (search "Starter2D and Starter3D and you'll see them). Just control the AdRotator from your main loop and try not to add two adrotator components. Check isEnabled and Invalidate on each screen if need be to enable/disable it.

Hope this helps
Jan 23, 2014 at 8:56 AM
Hey there,

thanks for the quick response :-)

We are still talking about XNA here, right? If so, on which object should I look for the AdClick event? AdRotatorXNA.Current does not seem to have it, not visibly at least :-(

As for the second issue - I will browse the examples, thanks for the tip :-)

Jan 27, 2014 at 8:28 AM
Ahh, it's only exposed for the default house ad not for the control it'self. Probably because this is not a requirement we have had before.
Will see about adding it to the V2 control.
Jan 27, 2014 at 2:21 PM
And when do you plan to release it, approximately?

If I understand right, the event is in the code and, yes? Would it then be possible to provide a custom version of the current release, only with the event made public?
Jan 27, 2014 at 6:08 PM
The V2 control is currently available in its Beta release from NuGet.

If you want to add that feature yourself then just download the code and make the modifications. If you wish you can fork the V2 code from GitHub and submit a PR with your change if you wish to contribute it back
Jan 30, 2014 at 9:06 AM
Ok, that about solves the AdClick matter, I will get in touch regarding the contribution once I figure whether I can achieve what I want with the code provided :-)

What still stands, though, is the Ad-Not-Showing problem. The tricky part here is that I am not the original creator of the game's code, so I am not 100% sure about its quality. I did what you said here and in another post, basically:

In the main loop, whenever the activeScreen is the X, Y or Z screen, I set the .Enabled value to true. Whenever the screen changes into another one, I set it to false. This works fine, the ad movement works fine as well. What does not work, is the display of the actual ad. It is visible on screen X, but on Y and Z it remains invisible, but perfectly clickable. I logged the Enabled and Visible fields and they both are true at the point. Any ideas?

Just to make sure - IsEnabled and Enabled are the same in case of the Rotator, right? The former returning the value of the latter?

Thanks for all the help :-)
Jan 30, 2014 at 10:16 AM
Ok, in that case with that pattern I'd suggest calling the "Invalidate" method on the control after you re-enable it. Just to kick off the ad gathering process
Jan 30, 2014 at 10:33 AM
The effect is the same - a clickable Ad, but not visible. Also, clicking this invisible Ad kicks the browserTask with a link, so I do not believe it is the Ad reception then causes the problem.

Can you confirm on my last question in the previous entry - are .Enabled and .IsEnabled the same in this case?
Jan 30, 2014 at 12:16 PM
IsEnabled is an AdRotator property to enable / disable the current AdProvider being served.

The Enabled property is the XNA drawable game component's property which will enable / disable adrotator (and the current ad provider displayed)
Jan 31, 2014 at 12:28 PM
Well, this is weird then... Oddly enough, when I log the Rotator's properties, I get Enabled=true, Visible=true and ComponentsContains=true.

I checked and it is now the same with a single, PubCenter Ad - clickable, not showing. The only thing which actually works is my custom HouseAd, with the banner graphic loaded from the resources.

I tried toying with the DrawOrder value, but to no avail.

Any ideas?
Jan 31, 2014 at 2:50 PM
Hmm, I wonder if the draw order between the adrotator component and the ad is showing is getting messed up somehow, true we don't set the order as the ad is always instantiated after the control so it shouldn't be an issue, also it is working fine in our samples.
If you ave the code you could try setting the "CurrentProvider" to a draw order of 100 or so in the invalidate function to see if that helps.