I’m messing with AdMob for WP8 and just realized that I cannot create AdView outside the GamePage class. If I do that, an error will pop up:
System.UnauthorizedAccessException was unhandled by user code
Detail message says it is an “Invalid cross-thread access”.
I also tried handling ads inside the GamePage class instead of my custom adsAgent class, but it seems the UI thread doesn’t have network access. The same error also exists in the official AdMob WP8 examples.
Now I have no idea how to proceed with AdMob WP8 integration…
Thanks man! But how do I create an adview instance inside my custom ads agent class constructor? Apparently I cannot do that inside Dispatcher.BeginInvoke()…
I tried this method inside the constructor and it worked. Thanks man!
But there came another issue: the game cannot receive any ad because of a “NetworkError”. I basically copied and pasted the admob wp8 example code and modified it slightly, and apparently this bug exists in the admob examples.