AdRotator control not working on multiple pages

May 14, 2012 at 4:07 PM

I have adrotator on my main app page and it works fine. However when I navigate to another page which has another adrotator control on it that control does not display any ads at all ever. Navigating back to the main page shows the adrotator control working. I am using Silverlight V1.1 of the control.

May 15, 2012 at 6:22 AM

Im having the same issue.  I am using Silverlight V1.1 of the control.

Coordinator
May 15, 2012 at 9:57 AM

I'll investigate the issue, our recommendation when implementing the ad control on multiple pages is to create your own shared user control and embed that in to the different pages (saves on duplication)

I'm currently updating the XNA and Silverlight XNA sample projects which all have ads on multiple pages in both XNA and Silverlight

Coordinator
May 15, 2012 at 4:24 PM

I found a bug in the current release where AdRotator wasn't being started when you viewed it from another page.

I'm currently doing another round of tests on the fix (and a few other minor ones) and also publishing some other sample apps that I have implemented the control in (SilverXNA projects).  just need to finish testing on the Silverlight version as the network at work causes me no end of problems.

Will let you know as soon as I upload it, hopefully soon.

Jun 5, 2012 at 9:15 PM
Edited Jun 5, 2012 at 9:16 PM

I create user control with Adrotator v1.1 Silverlight, and embed it into different pages, but the problem still exist. Even now the control does not display any ads at all. Will be uploaded the new release that will fix this issue soon?

Jun 6, 2012 at 2:02 AM

I'm waiting for the fix too.  Is it coming soon?

Coordinator
Jun 6, 2012 at 10:04 PM
Edited Jun 6, 2012 at 10:13 PM

Apologies for the delay in answering.

We recently re-released Version 1.1 to address the above issue but this discussion wasn't updated, see the notice here - http://wp7adrotator.codeplex.com/discussions/355856

 

The re-release was due to the above issue that was created when we introduced the threaded loading of config and this was quickly resolved once the issue was identified and we re-released V1.1 to address this.  Sorry for the confusion.

Unless there is some other critical issue were only working on improvements for Version 1.2 and simultaneously working on the V2 release were we also hope to include Win 8 support.

So if I could ask you to re-download version 1.2 and re-test checking on the other discussions on the multi-page problems we resolved.

Also note that it you should not require the dispose or invalidate calls on page load now as the control should sort itself out and pubcenter has since worked out it's problems that caused us to introduce it.  If you are still having issue try re-adding the calls but note we have found that AdMob seems to object to this so don't call dispose if you are using AdMob and if an AdMob ad is selected (test current AdType before disposing).

 

Were trying to find time to document all the new features and proper use of the control but it's a fine balancing act.  For now you can check the samples mentioned in the notice mentioned above.

Jun 12, 2012 at 1:46 PM

I just tried to add AdRotator to a couple of pages in my project with re-released version and still only the first instance of the control is working. I didn't found any examples with multiple pages here either. The sample provided with binaries is a single page only. So does anyone else succeded in putting adrotator on multiple pages in real life project?

Coordinator
Jun 12, 2012 at 2:59 PM

Sorry to hear your still having issue.

The two Starter Sample apps mentioned in the discussion link above have two pages in (which was used to test the original issue) one for XNA and one for SilverXNA (Silverlight base).

Both were tested working and can be used as a reference for building your app.

If your still having issue please feel free to download the source and try to narrow down where your issue is with the framework. Both Gergely and I are doing what we can when we can but time as ever is always against us, so if you can help diagnose your issue we'll help here we can

Jun 12, 2012 at 3:06 PM

I posted about my experiences with this problem here: http://wp7adrotator.codeplex.com/discussions/355792.

Basically on the second page, you need to invalidate twice

  1. in the page's Loaded event, which catches the forward navigation (like from the first page to the second page).
  2. in the OnNavigatedTo event, which catches the backward navigation (from the second page, tap the Start button, then Back).

...or at least that's what worked for me.

 

Dave

Jun 12, 2012 at 4:00 PM
Edited Jun 12, 2012 at 4:54 PM

Oh, you're right, I didn't tried the Starter apps. I've run those samples and the ads were working on both pages. I took the binaries from the sample project, just to be sure, and now there's still no ads on the second page, and only log message I get is "Control tested before loaded". Normal logging routine isn't starting after that. Could that indicate anything?

EDIT: Thanks dgdelage, it seems that your suggestion worked! You're the man.
Thank you very much Darkside for fast response and great work with this control. 

EDIT2: For anyone wondering: I just found out that adrotator stops invalidation on "Control tested before loaded" when put inside the pivot control. Outside the pivot everything is fine.

Coordinator
Jun 13, 2012 at 7:48 AM

I'm just looking into this. Just to clear it up for me

- If you used the workaround in the thread http://wp7adrotator.codeplex.com/discussions/355792 it worked on the second page as well, right? I'll look into resolving the issue in the control so that the workaround won't be needed.
- The control doesn't invalidate in the pivot control

Jun 13, 2012 at 9:10 AM

ad 1. Yes, before I used the the workaround invalidation was always stopped after "Control tested before loaded" (on pages other than first). Right now it works on 3 different pages. There are situations where the control isn't displaying ads after some navigation, but it could be the provider, I will check that soon.

ad 2. It seems like so, at least in my project. I didn't test it thoroughly though - right after I saw the control isn't invalidating I put it outside the pivot, and it worked.

Jun 14, 2012 at 10:32 AM

I forgot to mention one important thing - the control wasn't working in pivot control only when it wasn't the first instance. Before using the workaround, when adrotator was only on one page inside the pivot, it was working.

Coordinator
Jun 14, 2012 at 11:20 AM

Hey! I'll try to reproduce this and see if I can find the cause on why it's breaking in this specific case. If you have an example application and can send it over via email that would be helpful in terms of reproducing.

Jun 14, 2012 at 12:39 PM

Unfortunately I don't have any example app which I can send, but the base case was really simple: one panorama main page and one secondary page with pivot to which you can navigate from the main page. If you won't succeed in reproducing this behaviour i'll try to prepare a example in my spare time.

One more relevant issue: AdMob control was throwing exceptions, so I wanted to use Darksides suggestion to not call Dispose when AdMob is active, but there isn't any property like CurrentAdType that would tell me which type is currently used. There is only string value AdTypeName returned by the Instatiate method, which is not reliable and not elegant at all. My suggestion would be to add such a property. I would make a fork and pull request, but I think it's to much of a hassle for just one property.

One more interesting thing: even when I used Darksides suggestion, the Admob was crashing all the time - it stopped(I think) when I removed any Dispose and Instatiate calls from my main page ( first Adrotator instance). Ads on this page are still working fine, so it seems the workaround is not needed for the first instance of the control. I'll update if anything about this changes.