Cocos2d-js : How to integrate AdMob for Android - Part 1

Cocos2d-js : How to integrate AdMob for Android - Part 1

Test on:
- Mac OS X Yosemite
- python 2.7
- java jdk 1.7.0_71
- android-ndk-r10c
- cocos2d-js 3.2
- apache ant 1.9.4
- cocos code ide 1.2.0

For debug:
- adt-bundle-mac-x86_64-20140702

I'll show you step by step, how to integrate AdMob if we use Cocos2d-js NOT Cocos2d-x. You can skip some step as you known or have it to next topic.

[Create AdMob] *you must have one for make sure it's work.
1. goto this site https://www.google.com/admob/
if you never signup before just signup, if you have it just sign into AdMob.

2. create new app by goto "Monetize" and click "+ Monetize new app" as below image.


3. step 1. click "Add your app manually", type name in field "App name" and choose "Platform" as Android, then click "Add app"


4. step 2. choose "Banner" leave other as default then type name for "Ad unit name" and click "Save"


5. See under section "Select ad format and name ad unit", look after "Ad unit ID",
copy "ca-app-pub-xxxxxxxxxxxxxxx" and keep in text file. You must have it for test,
then click "Done".


[Setup Environment]
1. launch cocos code ide, then setup environment by goto Cocos code ide > Preferences... > Cocos as below image.


2. and goto Cocos code ide > Preferences... > Cocos > Frameworks as below image.



[Create Project]
1. right-click on space under JS Projects Explorer then goto New > Cocos JavaScript Project as below image.

2. create your project name from this sample is "CocosJsAdMob32" and click "Next >".


3. choose Orientation as you want, I just leave it as landscape don't forget to check "Add Native Codes" and click "Finish" .


4. your project was success created as below image.



Next part, we'll complete AdMob integration process.

----------------
Start AdMob Integration from Part 2:
http://gamedevtodied.blogspot.com/2015/02/cocos2d-js-how-to-integrate-admob-for_13.html

Debug Admob and Run or Build Apk with eclipse adt-bundle-mac from Part 3 END:
http://gamedevtodied.blogspot.com/2015/02/cocos2d-js-how-to-integrate-admob-for_16.html








Comments