Integrating Admob in Cocos2dx Windows/ Windows Phone Project
For integrating Admob in the Windows/ Windows Phone. You need the following things.
The main reason for taking the Cocos2dx 2.2.3 version is because before this version the Cocos2dx don’t support the XAML project version for windows/ windows phone & without the XAML support you cant integrate Admob in windows/windows phone.
Once you have download the Cocos2d 2.2.3 version. Extract the contents in a folder.
to create a project you can refer the following link .
After you create the project you see a WP8 XAML project. Open this project in Visual Studio for Phone. you see a Phone Xaml and Direct3D type of project.
In a Phone Xaml and Direct3D of application we have a XAML page. On that page we have a DrawingSurfaceBackgroundGrid in which the rendring of the Cocos2dx project is done.
So once we get the XAML page we all know how to integrate adMob on that. For those who don’t know how to add Admob below is the code. Before writing the code don’t forget to add the Admob SDK to you project and Admob AdUnitID to the code below.
//on XAML add a grid name "ads"
//on Page Load add the following
public AdView Ad_Control()
AdView bannerAd = new AdView
Format = AdFormats.Banner,
AdUnitID = "AdUnitID of AdMob"
bannerAd.ReceivedAd += OnAdReceived;
bannerAd.FailedToReceiveAd += OnFailedToReceiveAd;
AdRequest adRequest = new AdRequest();
adRequest.ForceTesting = true;
2,271 total views, 2 views today