Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

From The Blog: Important AdMob and other ad plugin changes
Started by CoronaBot Jul 22 2019 07:42 AM

11 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

CoronaBot

[GLOBAL: userInfoPane.html]
CoronaBot
  • Contributor

  • 426 posts
  • Corona Staff

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

[TOPIC: post.html]
#2

hogletpie

[GLOBAL: userInfoPane.html]
hogletpie
  • Contributor

  • 152 posts
  • Corona SDK

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!



[TOPIC: post.html]
#3

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,900 posts
  • Enterprise

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



[TOPIC: post.html]
#4

hogletpie

[GLOBAL: userInfoPane.html]
hogletpie
  • Contributor

  • 152 posts
  • Corona SDK

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!



[TOPIC: post.html]
#5

Aarbron

[GLOBAL: userInfoPane.html]
Aarbron
  • Enthusiast

  • 94 posts
  • Corona SDK

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",
        
    },
}


[TOPIC: post.html]
#6

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,900 posts
  • Enterprise

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



[TOPIC: post.html]
#7

Aarbron

[GLOBAL: userInfoPane.html]
Aarbron
  • Enthusiast

  • 94 posts
  • Corona SDK

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



[TOPIC: post.html]
#8

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,900 posts
  • Enterprise

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



[TOPIC: post.html]
#9

Aarbron

[GLOBAL: userInfoPane.html]
Aarbron
  • Enthusiast

  • 94 posts
  • Corona SDK

I'm stupid.

Thank you Rob.



[TOPIC: post.html]
#10

d.mach

[GLOBAL: userInfoPane.html]
d.mach
  • Contributor

  • 855 posts
  • Corona SDK

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

 

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



[TOPIC: post.html]
#11

d.mach

[GLOBAL: userInfoPane.html]
d.mach
  • Contributor

  • 855 posts
  • Corona SDK

 

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.



[TOPIC: post.html]
#12

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,900 posts
  • Enterprise

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




[topic_controls]
[/topic_controls]