Construct 2 and Admob Ads


#9

When do you get the error?

Are you talking about previewing the app from C2? If so, you can’t preview. You need to build with Cocoon.io for testing.


#10

Also the ads are only working in the Developer App or in the built android file.
You cannot test the ads in the browser, even if you woudn’t get the javascript error.

Regards


#11

I get the same error when i try to test in browser preview. I know it only works when is compiled but we need to make small changes and is very annoying to remove the plugin everytime i need to test in preview.


#12

If you include the CanvasPlus plugin, then use the Is Canvas + event before calling your ads, it should not give the error. I just tested it.

For example, I can run this and preview will work.

If I just try to put Load Ad Banner in start of layout, I get the error.


#13

Arcad, thanks for the tip on getting around error on preview. Where do I put “Set banner Layout” and “Show the banner ad”? On “On Banner Loaded”?

Do the banners show in Preview or only on device through APK?


#14

You can download our free code examples.

Those files show you a possible way how to use ads (and other functions).

Regards
Andy


#15

Depends on your game. I typically do it ON Start Of Layout of the layout I am showing ads on.

No, preview will not show ads at all. You will need to wait for the compiled APK to test them.


#16

Can I export to Cocoon or only Cordova to get ads working?


#17

Hi @CModProduction

You need to export to Cordova. You find a complete guide here

Regards
Andy


#18

Obrigado meu amigo !


#19

@andy_reitberger
I finally got ads working using your template! Thank you so much for that!

One issue is that my ads are refreshing to new banners every 1-2 seconds. I have it set in Admob to every 30 seconds. Do you know any reason for this?


#20

@andy_reitberger I think I see your response here:

I found the issue.
I submitted a Pull Request on Github.
Till the changes are live, please download the attached plugin and overwrite the existing one in C2.
Thank you!

cocoon_ads.zip


#21

Hi @jook00

Glad to hear that :slight_smile: yes that’s the fix :slight_smile: but it has been migrated in Github already, so if you download it from github, then it will work :slight_smile:

Let me know if you have any troubles :slight_smile:

Regards
Andy


#22

Works perfectly! Thanks!
Now i’m trying to move onto inapp purchases to unlock ads. Is there more documentation for that than this one here:
https://github.com/CocoonIO/cocoon-plugins-c2#inapps


#23

Awesome :slight_smile: I’m currently working on an InApp Store Template using the CocoonInApp plugin for c2. If you want I can send you a beta tester link when I’m back home.
So you can test it live. When it’s working I will write a doc file for that. Moreover I’ll release the template on Scirra then :wink:

Would appreciate your feedback! So just send me PM if you are intressted :wink:

Regards
Andy


#24

Please can you give me an screenshot of the events ?
One more question ? I am compiling as WebView+ and no ads are showing ? Is that a problem ? When I use Canvas+ I get black screen!


#25

Conseguiu?
Pode me mandar print plz?


#26

Please stick to english!
Thank you


#27

hello the cocoon ads plugin was work great. but now it not work anymore ads not showing and also i get a javascript error when i preview the game in my browser. any solution please ?


#28

Hi,
The js error at the Browser preview is normal, it’s just an uncaught exception. Running on a mobile this will not happen.
To avoid the errors in preview, just add the condition “System -> Is on platform [Cordova]” to every action / event from the CocoonAds plugin.

Regards
Andy