i want to have ads in my game and for this i’m using AdMobs but i always have problems with it.
I’m using this code here:
appID = "ca-app-pub-xxxxxxxxxxx/xxxxxxxxx" local adProvider = "admob" local function adListener( event ) -- The 'event' table includes: -- event.name: string value of "adsRequest" -- event.response: message from the ad provider about the status of this request -- event.phase: string value of "loaded", "shown", or "refresh" -- event.type: string value of "banner" or "interstitial" -- event.isError: boolean true or false local msg = event.response -- Quick debug message regarding the response from the library print( "Message from the ads library: ", msg ) if ( event.isError ) then print( "Error, no ad received", msg ) elseif ( event.phase == "loaded" ) then print( "loaded" ) elseif ( event.phase == "shown" ) then print( "shwon" ) else print( "Ah ha! Got one!" ) end end ads.init( adProvider, appID, adListener ) ads.show( "banner", { x=display.contentWidth, y=1000, appId="ca-app-pub-xxxxxxxxxxx/xxxxxxxx", testMode = true})
I had the testMode in false 1 or 2 days ago and after a lot of hours i’ve got ads in my app, but everytime i change my code, the ad will not be shown for a lot of hours. Is that normal?
Also, is it right that on every change in my code, the ad will first disappear?
My last change was about 24 hours ago and till now no ads are shown and i get a different message: “the ad request was successful but no ad was returned due to lack of ad inventory”.
And even when i’m now testing with testMode = true, i dont get any ads shown, i always get the same message.
Is this all normal or am i doing something wrong? Its really hard to test if you have to wait so many hours every time you change something in the code, this cant be normal. And now it seems that i wont get any ads…
I haven’t ran the code, but in your show call you set “x” to the width of the display, which will surely put the ad ( as that’s the left position of the ad ) off screen?
Try setting that to 0. Also make sure the “y” value is correct, as a test set that to 0 as well.
Also, if that’s your actual code, you’re calling .show() immediately after .init() which for many of our plugins is an asynchronous operation meaning it starts the init process in the background because it can take some time and you don’t want to block the app. I’m unsure about the AdMob plugin, but there is a good chance you’re calling .show() before .init() finishes.
Now if you’re .show() is reasonably delayed and you just pasted the code in to show us, then that’s probably not the answer.
Okay but the plugin costs 199$ / year, that is way too much, i want to make money with ads and dont lose money for the plugin…
In the post it says “Note that your apps currently available in various app marketplaces will continue to serve ads — this only impacts new builds and updates starting on March 1.”
My project is older then that, did this mean that i still can use the legacy AdMob plugin? The legacy AdMob plugin works for me but i need to wait a lot of hours.
What that means is if you have an App in the store already using AdMob and you never update date it, it will continue to serve ads. If you want to update it, you will either have to use the paid AdMob plugin or consider using Appodeal which has AdMob included in its mediation and links to your existing AdMob account. Appodeal is free for you to use.
It all depends on what you’re looking to implement. I’d probably recommend different plugins depending on if you want banners or rewardedVideo. You might want to start with Appodeal.
If you are using banners Appodeal will produce the highest fill of the free ones. As for interstatial I like AppLovin even with the 5% tax. They consistently outperform any ad network that I have tried.
I haven’t ran the code, but in your show call you set “x” to the width of the display, which will surely put the ad ( as that’s the left position of the ad ) off screen?
Try setting that to 0. Also make sure the “y” value is correct, as a test set that to 0 as well.
Also, if that’s your actual code, you’re calling .show() immediately after .init() which for many of our plugins is an asynchronous operation meaning it starts the init process in the background because it can take some time and you don’t want to block the app. I’m unsure about the AdMob plugin, but there is a good chance you’re calling .show() before .init() finishes.
Now if you’re .show() is reasonably delayed and you just pasted the code in to show us, then that’s probably not the answer.