[quote=“bjsorrentino,post:84,topic:342466”]
To those upgrading to the new AdMob (paid), we understand that time=money, so I just wanted to mention that conversion (from old AdMob “v2”) should be extremely easy… and honestly, the new AdMob plugin is better and cleaner as well.
To assist you, I just created a sample project on GitHub using the new AdMob plugin which you can use as a model for your own apps.
And, as follows are some basic tips/guidelines for updating, along with notes of various improvements. If you need more details, the documentation should be (as always) your first go-to source.
-
Include the new AdMob plugin in your “build.settings” file:
settings = { plugins = { [“plugin.admob”] = { publisherId = “com.coronalabs”, supportedPlatforms = { iphone=true, android=true } }, }, }
-
Do your Lua require() as “require( “plugin.admob” )”, not the old “ads” CoronaProvider framework.
local admob = require( “plugin.admob” )
-
Initialize the AdMob plugin with “admob.init()”, but skip the “providerName” argument and follow the new syntax. Since you should only be calling this function once per app, this change should take literally no time:
– OLD admob.init( providerName, appId, adListener ) – NEW admob.init( adListener, { appId=“YOUR_ADMOB_APP_ID”, testMode=true } )
-
Load ads via “admob.load()”. This function has been improved in the new plugin and it now works with both interstitial and banner ads. The old plugin was awkward in how this call would only pre-load interstitial ads, while the “.show()” call would attempt to both load and show banner ads (but only show interstitials). Essentialily, we’ve re-designed “admob.load()” to work far more logically: pre-load the exact ad type you want, along with an AdMob ad unit ID from their dashboard. You can even load COPPA-compliant ads for child-safe apps directly in this call. For example:
admob.load( “interstitial”, { adUnitId=“YOUR_ADMOB_AD_UNIT_ID”, childSafe=true } )
-
Once you know an ad is loaded, using the familiar “admob.isLoaded()” call or by checking for a “loaded” event phase, show an ad via “admob.show()”. In the new AdMob plugin, this call has the added bonus of a “top” and “bottom” screen positioning string for banners, in addition to custom y positioning (number)… this surpasses the awkwardness of the old plugin and dealing with content area, content scale, Android “immersiveSticky” mode, and other issues. Also, the x positioning of banners is now gone since the new plugin uses “smart banners” that span the entire width. Finally, some strange aspects of this call from the old plugin have been resolved: you don’t specify test mode here (that’s now done in “admob.init()”) and you don’t specify child-safe ads here (that’s now done in “admob.load()”). Here’s an example of the new “admob.show()” call:
admob.show( “banner”, { y=“top” } )
OTHER
Other improvements include better implementation of the “admob.height()” call for banners. In the old plugin, this call was awkward because you’d need to call “.show()” and then “.height()” to get the height of the banner “after the fact” for custom y positioning. Now, since banners are pre-loaded, you can get the height of the banner before you show it, allowing you to get a pixel-perfect vertical alignment with other UI elements in your app, if you need that level of control… or, as mentioned above, just use “top” or “bottom” for screen-edge alignment and forget about the messy issues the old plugin entailed.
Finally, the new plugin works seamlessly with the new Android Dependency framework (this is why it requires daily build 2016.3005 or higher). For a long, long time, the old AdMob plugin caused compatibility issues with other plugins like Google Play Games Services and Google Analytics, among other monetization plugins, making maintenance of it extremely difficult and causing all sorts of support issues for developers who tried to use various plugins in tandem with it. The new AdMob plugin fully resolves these issues and is future-proof for Android.
I hope this helps explain basic conversion to the new AdMob plugin, along with logical improvements we made to it.
Happy holidays,
Brent [/quote]
Does the new admob plugin work with firebase?