Tutorial: Add admob interstitial ads to your CoronaCards Windows Phone 8 app

For anyone interested I created this tutorial on how to integrate admob interstitial ads into your corona windows phone 8 app:

http://www.spacewolfsoftware.com/blog/tutorial-add-admob-interstitial-ads-to-your-corona-windows-phone-8-app/

Hope this helps!

Thanks spacewolf, That’s awesome!  Hopefully I’ll get to go through it soon!

Hi Spacewolf,

appreciate the time taken for you to put this togethor.

I had solved the banner ads and was going to sort the fullscreen out BUT you saved me lots of time.

Will test it out later today

good job

Ok, Iam having issues trying to get to interstitials working, maybe it is my lack of experience .

So I built a complete fresh project and tried to build the example…hmmm  no joy.

Can someone verify its working correctly please

What error are you getting?

I added some details about how to successfully compile the sample application when you download it.

@spacewolf,

hi, no problems now all fixed.

I was adding the code to an original project, now I did it the opposite way round and all is good.

Thanks for formatting the code also, excellent job, thumbs up !

Thanks for your tutorial Spacewolf. I can run the sample project without any issues.

When I try to apply your tutorial steps to my own project however, I get the following errors in Visual Studio Express 2013 for Windows Update 3:

The type or namespace name ‘InterstitialAdControl’ could not be found (are you missing a using directive or an assembly reference?) 

The name “LocalizedStrings” does not exist in the namespace
 

Any idea what the underlying cause could be? The project runs fine (although without ads) when not applying the steps described in the tutorial.

One difference between the sample project and mine I’ve noticed is that my .sln and .suo files are in a directory higher than de files of the rest of my project. However, simply moving the .sln and .suo files to the same dir as  the rest of the files causes the project to be unusable.
 

@prodesuka

The first error means the compiler can’t find the class definition for your InterstitialAdControl class. 

  • Open InterstitialAdControl.cs - after the using statements at the top of the file you should see a line something like “namespace xxxxxxxxxxxxxxx”. This line declares the namespace of the class. The namespace should match the rest of your project namespace. For example, if your project were named “ShooterGame”, than this line should look like “namespace ShooterGame”. You can open up MainPage.xaml.cs and look at the namespace line there. The namespace line in InterstitialAdControl.cs should match that.

I’ve updated the tutorial to fix this problem. Thanks for bringing it up!

It actually doesn’t matter where the solution files are located. When you created the project, you can choose to have the solution files in their own directory or in with the project files (specified by checking a box next to this option or not in the create project dialog.)

The namespace change worked, thanks.

I get the error message below when I try and add the AdMob reference to the project…any ideas what the problem is?

ERROR: A reference to a higher version or incompatible assemly cannot be added to the project.

I found the solution:

The file is being blocked by Windows, as downloaded content is deemed unsafe. The solution is to right-click on the unpacked monitor file, select Properties, and click Unblock.

@Mike 

Thanks for posting the solution! I’ll see if I can add this gotcha to my tutorial.

Anybody know how to solve this error message?

Error 1 Retrieving the COM class factory for component with CLSID {2D0A16C9-53D9-42C1-BCC2-8D2A135E2163} failed due to the following error: 8001010e The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD)). 0 0

This probably means your code is trying to update a UI component when your code is not running on the UI thread. Are you building for 8.0 or 8.1?

If you are building for 8.0, try wrapping that particular code in this:

Dispatcher.BeginInvoke(() =\> { // Place the code that accesses your UI component in here. });

This will marshall your code onto the U.I. thread.

@spacewolf 

The target OS is 8.0 like you specify in your tutorial. Where do I put the code you have listed above?

Did you download, compile, and run the sample application? If so it should run as-is.

If you are you are trying to integrate the admob code into a different project then I would need to see your code. Can you track down the line of code and method that is throwing the exception your getting?

First I tried it in my own project and when I got the error I did it on your download example and get the same error. How do I  track down the line of code and method that is throwing the exception?

FYI … I am using Visual Studio Express 2013 and Corona Cards 2506

You could try setting breakpoints at various places in the C# code and then stepping through with the debugger and see exactly when the exception gets thrown.

I updated to the newest version of Corona Cards and now I get the following error…any ideas what is going on?

Error 1 Exception from HRESULT: 0x89721800 0 0

Now this is happening to all of my projects which were fine before!

How can determine if an ad has been show on the LUA side of things?