Saturday, January 01, 2011

WP7 - "Manual rotation cannot be used in automatic rotation mode"

If you ever get the less than information exception message: "Manual rotation cannot be used in automatic rotation mode", then it is most probably because you are using Microsoft’s AdControl for Windows Phone 7 and you created your AdControl instance with rotation enabled and you also requested the control to display a new ad.

Here is what you need to know:

When you specify that rotation is enabled in the AdControl constructor, then the AdControl will automatically display new ads and you don’t have to do anything. But if you do enable rotation of ads, then you cannot call “RequestNewAd”, else you will get the exception shown above.

Thoughts:

The error is basically stating that you cannot manually rotate Ads when the Ad control was instantiated to automatically rotate the ads. The reason I don’t like the exception message is that just by looking at the message its hard to figure what it means or what caused it. In addition, the fact that the message was being caused on the Windows Phone, it led me on a wild goose chase looking for issues with the code that handled orientation changes of the phone. (Though, I must admit that if I had groked the AdControl docs, I would have known what the rotation argument actual stood for, instead of assuming that it meant the control supports orientation changes).

More Info:

RequestNextAd: http://msdn.microsoft.com/en-us/library/ff973787(v=msads.10).aspx

AdControl class: http://msdn.microsoft.com/en-us/library/ff973756(v=msads.10).aspx

No comments: