From The Blog: Important AdMob and other ad plugin changes

It seems that all of our news lately has been wrapped around Google, and so it is again. AdMob has update their libraries again, and in doing so, created a breaking change. Your app’s App Id previously was only needed at the time you initialized the plugin. Google is now looking for it inside the AndroidManifest.XML file. If you wish to use AdMob as well as Appodeal (since it includes AdMob), you must add this to your build.settings:

settings = { android = { applicationChildElements = { [[\<meta-data android:name="com.google.android.gms.ads.APPLICATION\_ID" android:value="[YOUR\_ADMOB\_APP\_ID]"/\> -- replace with your app id. See: https://goo.gl/fQ2neu ]], } }, plugins = { ["plugin.admob"] = { publisherId = "com.coronalabs" }, }, }

Simply replace the [YOUR_ADMOB_APP_ID] with your actual App ID inside the quotes and with out the square brackets.

In addition, many of you are still referencing the old legacy AdMob plugin since it was a dependency for many other ad plugins. Please look through your build.settings and remove any references to:

["plugin.google.play.services"]

If you do not remove this, your build will fail and you should get an error message in your console using the latest builds.

You should make these changes before your next attempt to build for Android. See the AdMob implementation documentation for more details.

View the full article

Is it safe to assume that for my (iOS) apps (that use the paid AdMob plugin) that have not been updated since 2017 then there is no need to update?

Thanks!

No, it’s not safe to assume that. Google apparently made a backend changes that cased rewarded videos to start failing. Updating to newer plugins (with newer SDKs) seem to have addressed these issues.

If you’re not using rewarded video, you may be safe for now.

Rob

Thanks very much for the reply. I am not using rewarded video and the interstitial ads (static and video) and banners are showing as of July 23rd 2019.

Thanks!

Hello!

We got to use the exact same code (copy paste) for iOS builds?

Also can we change the order and do something like this?

settings = { plugins = { ["plugin.admob"] = { publisherId = "com.coronalabs" }, }, android = { applicationChildElements = { [[\<meta-data android:name="com.google.android.gms.ads.APPLICATION\_ID" android:value="[YOUR\_ADMOB\_APP\_ID]"/\> -- replace with your app id. See: https://goo.gl/fQ2neu ]], } }, }

edit!

One more question please!

Are we allowed to do this too?

Using android twice, at the top and bottom of code.

settings = { android = { applicationChildElements = { [[\<meta-data android:name="com.google.android.gms.ads.APPLICATION\_ID" android:value="[YOUR\_ADMOB\_APP\_ID]"/\> -- replace with your app id. See: https://goo.gl/fQ2neu ]], } }, plugins = { ["plugin.admob"] = { publisherId = "com.coronalabs" }, }, android = { versionCode = "100", }, }

For iOS, you do not need the applicationChildElements. This is in the android table, which means it’s only used during android builds.

You may only have one android subtable in build.settings, the second one would overwrite the first.

Rob

How about the order?

Does it matter which block of code (plugins, android) is first or second?

I’m asking because I want to have the plugins on top and android after.

Also the “APPLICATION_ID” is the the same as the package name?

com.mycompany.mygame

Lua tables, the order of items doesn’t matter. The keys tend to be presented in random order anyway.

Feel free to put the plugin block at the top.

In this case com.google.android.gms.ads.APPLICATION_ID is a key with that exact name. You should not substitute anything for APPLICATION_ID.

Rob

I’m stupid.

Thank you Rob.

Does this mean older iOS apps using admob don’t need an update?

admob-2-1-150x150.pngIt seems that all of our news lately has been wrapped around Google, and so it is again. AdMob has update their libraries again, and in doing so, created a breaking change. Your app’s App Id previously was only needed at the time you initialized the plugin. Google is now looking for it inside the AndroidManifest.XML file. If you wish to use AdMob as well as Appodeal (since it includes AdMob), you must add this to your build.settings:

settings = { android = { applicationChildElements = { [[<meta-data android:name=“com.google.android.gms.ads.APPLICATION_ID” android:value="[YOUR_ADMOB_APP_ID]"/> – replace with your app id. See: https://goo.gl/fQ2neu ]], } }, plugins = { [“plugin.admob”] = { publisherId = “com.coronalabs” }, }, }

Simply replace the [YOUR_ADMOB_APP_ID] with your actual App ID inside the quotes and with out the square brackets.

In addition, many of you are still referencing the old legacy AdMob plugin since it was a dependency for many other ad plugins. Please look through your build.settings and remove any references to:

[“plugin.google.play.services”]

If you do not remove this, your build will fail and you should get an error message in your console using the latest builds.

You should make these changes before your next attempt to build for Android. See the AdMob implementation documentation for more details.

View the full article

Can you please post a sample for the correct replacements? It’s a little bit difficult to figure this out.

settings = { orientation = { default = "portrait", supported = { "portrait" } }, splashScreen = { enable = false }, android = { usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.WRITE\_EXTERNAL\_STORAGE", }, applicationChildElements = { [[\<meta-data android:name="com.google.android.gms.ads.APPLICATION\_ID" android:value="ca-app-pub-5387163376908424~XXXXXXXXXXXX"/\> -- replace with your app id. See: https://goo.gl/fQ2neu]], } }, iphone = { xcassets = "Images.xcassets", plist = { NSCalendarsUsageDescription = "", NSAppTransportSecurity = { NSAllowsArbitraryLoads=true }, NSLocationAlwaysUsageDescription = { "" }, NSLocationWhenInUseUsageDescription = { "" }, NSPhotoLibraryUsageDescription = "This app does not access the photo library.", NSCameraUsageDescription = "This app does not use the camera.", UILaunchStoryboardName = "LaunchScreen", } }, plugins = { ["plugin.admob"] = { publisherId = "com.coronalabs", } }, }, }

Hopefully this helps.

Rob

Thanks for the info! Is the iphone part from the code above needed for iOS versions with new builds and updates?

One more question because of the XXXXXXX part:

android:value="ca-app-pub-5387163376908424~XXXXXXXXXXXX"/\> -- replace with your app id.

The sample is showing the number 5387163376908424 but when using this for with my own new build I have to replace the whole content in the brackets, right?

So this should all be replaced like this?.. ca-app-pub-XXXXXXXXXXXXXXXX~XXXXXXXXXX

I tried to show you as much of a valid App ID that I was comfortable showing. Replace the 

ca-app-pub-XXXXXXXXXXXXXXXX~XXXXXXXXXX

with the value you get in the AdMob developer console. It should be inside the quotes the /> at the end is important (as it closes an XML element on the previous line.

Rob

Thank you!!!

The iOS portion hasn’t changed in a while and should work with modern versions of Corona and iOS builds.

Rob

Can anybody confirm that admob is working correctly on Android with this new changes in the build.settings? Interstitials and rewarded ads?

Yes it works great for me. Interstitials and rewarded.

Tested on many apps.

My personal apps and my customers.

I haven’t tested with 64bit!

Maybe somebody else can post about 64bit.

Thank you for the info. Did you use a 64bit ready build version of Corona?