How can I add ads.show (admob) to a scene?

Hi!

I try to add commercials in my game. I’ve done everything like on this video: https://www.youtube.com/watch?v=zTPr4X-kkZ4 but it doesn’t work. I want to know if it’s possible to add ads.show to a group of scenes and if yes, how?

local composer = require( "composer" ) local scene = composer.newScene() function scene:create( event ) local sceneGroup = self.view -- Code here runs when the scene is first created but has not yet appeared on screen ??? end

Generally speaking with any ad provider, you will in:

build.settings: Include the plugin code inside the settings.plugin table:

settings = { plugins = { ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, }, }

This is added to your existing settings table. If you already have a plugins sub-table in your settings table, then you just add the plugin code itself.

Next in main.lua:

  1. Require the plugin at the top of the file.

  2. Somewhere before you go to your first scene, include the listener function and then call the .init() method.

Finally in whatever scene you want to show ads in:

  1. require the plugin at the top of the scene.

  2. Call the .show() method to show the ad.

Depending on your app’s flow and the ad provider you chose, you might want to pre-load the next ad some time before you actually want to show it.

This basic workflow works for all of our monetization plugins. AdMob is our oldest plugin. It’s limited to banners and interstitial ads. We have many other ad providers to choose from and you might find higher and better payouts with our other providers.

Rob

Ok… I try with Monetize Corona, but I don’t see my ads :confused:   But I look at my account and there (Impressions: 6) How?

There are many reasons why you won’t see ads:

  1. Your ad provider doesn’t deliver ads to non-live apps.

  2. Your ad provider doesn’t have any ads for your app (fill rate). Some ad providers do a better job of filling ad requests and it does vary wildly by the country you are in.

  3. You have an error in your code.

  4. Something isn’t setup right in your ad provider’s dashboard.

Your device has a console log with messages written out by the operating system and by various apps. You need to learn how to read this console log file on your device and look for the proper errors. It also helps to put “print()” statements in your ad listener function and print out what’s going on. There will be information there as to the cause of you not getting an ad.

But until you can add in those print statements and look at your console log, you’re not going to have any information about what’s going on.

See: https://docs.coronalabs.com/guide/basics/debugging/index.html 

This is an important skill for you to gain if you want to figure out what’s going on.

I can’t explain why you show 6 impressions and haven’t seen any ads. But there is probably an error message in the console log that might give a starting point to figure out why.

Rob

WARNING: The ‘plugin.coronaads’ library is not available on this platform. - Error message in the console.

Generally speaking with any ad provider, you will in:

build.settings: Include the plugin code inside the settings.plugin table:

settings = { plugins = { ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, }, }

This is added to your existing settings table. If you already have a plugins sub-table in your settings table, then you just add the plugin code itself.

Next in main.lua:

  1. Require the plugin at the top of the file.

  2. Somewhere before you go to your first scene, include the listener function and then call the .init() method.

Finally in whatever scene you want to show ads in:

  1. require the plugin at the top of the scene.

  2. Call the .show() method to show the ad.

Depending on your app’s flow and the ad provider you chose, you might want to pre-load the next ad some time before you actually want to show it.

This basic workflow works for all of our monetization plugins. AdMob is our oldest plugin. It’s limited to banners and interstitial ads. We have many other ad providers to choose from and you might find higher and better payouts with our other providers.

Rob

Ok… I try with Monetize Corona, but I don’t see my ads :confused:   But I look at my account and there (Impressions: 6) How?

There are many reasons why you won’t see ads:

  1. Your ad provider doesn’t deliver ads to non-live apps.

  2. Your ad provider doesn’t have any ads for your app (fill rate). Some ad providers do a better job of filling ad requests and it does vary wildly by the country you are in.

  3. You have an error in your code.

  4. Something isn’t setup right in your ad provider’s dashboard.

Your device has a console log with messages written out by the operating system and by various apps. You need to learn how to read this console log file on your device and look for the proper errors. It also helps to put “print()” statements in your ad listener function and print out what’s going on. There will be information there as to the cause of you not getting an ad.

But until you can add in those print statements and look at your console log, you’re not going to have any information about what’s going on.

See: https://docs.coronalabs.com/guide/basics/debugging/index.html 

This is an important skill for you to gain if you want to figure out what’s going on.

I can’t explain why you show 6 impressions and haven’t seen any ads. But there is probably an error message in the console log that might give a starting point to figure out why.

Rob

WARNING: The ‘plugin.coronaads’ library is not available on this platform. - Error message in the console.