Admob interstial ads in cocos2d-js

@ckh You are right. It’s necessary to first package your game to apk, and then load that apk into AnySDK where it will be repackaged to include your chosen plugin code. From what I gather, this is meant to be the advantage of AnySDK - you integrate AnySDK once, and then you can use 1000 plugins without having to integrate the plugin code yourself.

Your code looks correct. Later you may want to preload your Interstitial ads by calling ads_plugin.preloadAds(1);

@victor88888 i’m still getting error when trying to upload the apk file, and i think it is related to Python as attached

Maybe i should upgrade or downgrade the python version, i will try later :wink:
UPDATE: updating my python version fixed this, now i’m publishing inside anySDK, but after 5 min the progressbar still at 0%, strange.

One more question:
in the Ad config section within anySDK, you could put more than one banner ad, same for interstitials, but how to show and call a specific one within my code??

with ads_plugin.showAds(1) i’m specifying the type of the add only and not the size ( in case of banner Ad) or unit ID.

AnySDK will stop working on Windows7, so let’s use 8 or 8.1 instead

@ckh Very weird that your AnySDK isn’t working. As a last resort, you can try the Chinese version http://www.anysdk.com/downloads which has a full installer and may work better.

If you want to show your second interstitial Ad, you’d simply call ads_plugin.showAds(1, 2); where the second parameter is the index of your ad. All this stuff can be found in the autoanysdkbindings_api.js file (in the folder \Frameworks\js_1.5.1\AnySDK_Framework_JS(Android)\api_js)

The size and position of banner ads can be set in the AnySDK software under the SDK parameters for your banner ad (right near where you enter the UnitId).

1 Like

@raksa doo you have any reference from the official website? i prefer to avoid the OS switch now for anySDK!!
@victor88888 i will try the chinese version, but how much time does it takes in general the apk re-packaging in anySDK?

i got this bug, then try use it in another computer with 8.1 version of Windows. and it works well now. but don’t have any ideas beside this

@victor88888 @raksa i fixed this issue after updating all plugins inside the anySDK app, even those that i’m not using or planing to use.

@victor88888 i have now my app with anySDK and admob integrated, thanks to your support and Help !!!, and hope that this thread could help someone else trying to integrate them in the future :smiley: :smile:

one more question, do you have any idea on how to debug our application with anySDK plugins (if possible)? it is really a must to see our plugins in action before packaging them into apk, now my application gives runtime error when runing on debug mode from cocosIDE as it could not find the anySDK.

Thanks again :smiley:

@ckh congrats on getting it working! :slight_smile: To debug applications with the AnySDK plugin active, I simply run the Cocos Code debugger with the APK which was packaged with AnySDK. I can then step through the code and debug as usual.

Thanks for your help @victor88888, but currently i implemented the admob directly within the cocos project without any additional p.lugin, i found this solution more straight forward also allowed me to use google analytics as well using the JSB reflection, thanks !!

@ckh

Interesting… would you mind sharing how you did the Google Analytics integration? I’m also new to this and can’t figure out how to integrate GA in a proper way for both iOS / Android.

Thanks in advance ;-).

@wuotr i followed the exact google documentation to integrate the google play service into a normal android native project. you could follow the tutorial as well. very clear and very detailed. everything mentioned there could be applied here, don’t forget that at the end you are compiling an android project.

in the Google official documentation there is a select-box to choose your IDE, where you could choose between : 1- android studio or eclipse IDE or custom IDE. go and choose custom IDE where you will do most steps by command line but they are really easy.

Once implemented, you could call all native function to start tracking using JSB reflection.

let me know in case you face any problem during setup.

Good luck

@ckh

It works great indeed… Thanks for the info ;-).