lhan
lhan

Reputation: 4635

Windows Phone 8 AdControl AdException?

I've been testing a new Windows Phone 8 app for the last couple of weeks. I haven't yet published it to the Store yet, so I've only tested my AdControls with test values (i.e. "test_client" and "Image480_80").

I noticed the other day as soon as I launch my app, I see the AdControl for a second, and then it disappears. No error is thrown on the app's interface, but in the Output window I can see the following exception:

An exception of type 'Microsoft.Advertising.Shared.AdException' occurred in Microsoft.Advertising.Mobile.DLL and wasn't handled before a managed/native boundary

Here is the stack trace:

at Microsoft.Advertising.Shared.AdvertisementFactory.CreateFromResponse(String response, AdDownloadCompleteCallback adDownloadCompleteCallback)\r\n
at Microsoft.Advertising.Shared.AdPlacement.CreateAdvertisement(Byte[] bytes)\r\n at Microsoft.Advertising.Shared.AdPlacement.AdRequestComplete(IWebRequestWrapper request)

Here is my code which adds the AdControl to my Grid:

    AdControl adControl = new AdControl("test_client", "Image480_80", true);

    adControl.Width = 480;
    adControl.Height = 80;

    adControl.ErrorOccurred += AdUnit_ErrorOccurred;

    MyGrid.Children.Add(adControl);

    Grid.SetRow(adControl, 4);
    Grid.SetColumn(adControl, 4);

This was working fine up until a few days ago, so I'm not sure if the code needs to change but is there anything else I can check? I saw an article that said to make sure I've got the required capabilities in my WMAppManifest.xml file. Here's what I've got currently:

<Capabilities>
  <Capability Name="ID_CAP_NETWORKING" />
  <Capability Name="ID_CAP_MEDIALIB_AUDIO" />
  <Capability Name="ID_CAP_MEDIALIB_PLAYBACK" />
  <Capability Name="ID_CAP_SENSORS" />
  <Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
  <Capability Name="ID_CAP_IDENTITY_USER" />
  <Capability Name="ID_CAP_MEDIALIB_PHOTO" />
  <Capability Name="ID_CAP_PHONEDIALER" />
</Capabilities>

Does anyone know of anything else I can check - or know what I may be doing wrong? I'm really stumped. If there's anything else I can post from my Exception object (in addition to the stack trace above) please let me know, although I didn't see anything that hinted at a possible problem.

UPDATE:

I can also confirm that using my actual ApplicationID and AdUnitID in place of the test values that the exact same thing happens. Has anyone else experience this?

UPDATE 2:

I've been emailing back and forth with PubCenter Support, and they've apparently been able to replicate the problem because the analyst helping me (Support Analyst II) has now engaged the engineering team to look into the problem. There is no ETA on a resolution but they said using my actual ApplicationID and AdUnitID should work when testing on an actual device (although I already confirmed it does not work in my emulator).

UPDATE 3:

I'm still waiting to hear back from PubCenter Support, but I have now confirmed that Ads DO WORK successfully if I use the real ApplicationID and AdUnitID. Previously, I thought this didn't work, but it appears it only doesn't work when running in the emulator - on the device itself, they work fine. So it is only test ads that don't seem to work, and since that's the case, I'm not too worried about it.

UPDATE 4 (SOLUTION):

OK - After weeks of back and forth with PubCenter Support I finally have a solution, although I'm pretty sure it was an issue on their end that is now resolved. I had created a very simple test solution which demonstrated my problem that I sent to them and they finally concluded that this:

AdControl adControl = new AdControl("Test_client", "Image480_80", true);

Needed to be this:

AdControl adControl = new AdControl("test_client", "Image480_80", true);

Upvotes: 3

Views: 2507

Answers (3)

lhan
lhan

Reputation: 4635

Apparently, this:

AdControl adControl = new AdControl("Test_client", "Image480_80", true);

Needed to be this (note the lowercase "t" in test_client):

AdControl adControl = new AdControl("test_client", "Image480_80", true);

Who would have thought?

Upvotes: 1

D. Dowdall
D. Dowdall

Reputation: 11

I have the same problem. The ads in my WP7.5 app work in both the emulator and the phone. When I upgrade my app to WP8 the ads stop working. So, I added a second ad provider control to my app and made it so that if MS ad control gets an error it hides and displays the 2nd ad from a different company.

Upvotes: 0

Joachim Isaksson
Joachim Isaksson

Reputation: 180897

To find out more specific error information, you can inspect the AdErrorEventArgs passed to the AdControl.ErrorOccurred event you've already registered. If it's still not clear from that information, please add the error/error code to your question.

The reason I've seen this exception show up is that there are no ads to display (ie you've specified a too narrow selection of ads to display and there are no matching ones available), but that should in that case be clear when you view the error.

Upvotes: 1

Related Questions