poingstudios / godot-admob-plugin

This repository is for Godot's Addons to integrate natively AdMob to your Game Project without much configurations and directly inside Godot Editor!
https://poingstudios.github.io/godot-admob-plugin/
MIT License
331 stars 24 forks source link

Engine.has_singleton("AdMob") returns false #102

Closed lucaleonardi closed 1 year ago

lucaleonardi commented 1 year ago

Godot version

3.5.2

Plugin version

1.3.4

System information

Windows 10

Phone information, if applicable

No response

Issue description

I'm testing the Example.tscn scene that comes with the plugin, but I can't seem to make it work. Checking the code and doing some tests, I found out that the code Engine.has_singleton("AdMob") returns false. This prevents the Object _plugin from being set in the AdMobSingleton.gd, probably breaking the whole plugin?

func _ready() -> void:
    if config.general.is_enabled:
        if (Engine.has_singleton("AdMob")):
            _plugin = Engine.get_singleton("AdMob")
            initialize()
            _connect_signals()

Am I missing something here?

Steps to reproduce

  1. Download the plugin from the Asset Store in Godot 3.5.1
  2. Try to run the example scene Example.tscn
  3. The plugin never gets initializated

Additional context

No response

gumaciel commented 1 year ago

The AdMob only works for Android and iOS, you need to download and install the plugins for the platforms.

Please check this video: https://www.youtube.com/watch?v=ZnlH3INcAGs

lucaleonardi commented 1 year ago

Thank you!

I missed the step about adding the android-standard-template-[version].zip content to the android/plugins folder and in fact I didn't had the option "Ad Mob" in the Android export. I think that it's missing for Godot version 3.5.2, so I had to downgrade to 3.5.1.

I'm still having issues tho: following the video with a blank new project works, but if I try to implement this on the game I'm working on, after I export the apk and run the Example scene I get:

Rewarded failed to load, error_code = 3
Rewarded Interstitial failed to load, error_code = 3
Interstitial failed to load, error_code = 3

What is error_code = 3? I read online that it may be caused by not setting the correct unit ID, but I left the default values (for example for Interstitial ads is ca-app-pub-3940256099942544/1033173712). What other options from the export settings could possible cause this issue? Is it possible that having the Keystore Release fields set create problems while using test unit IDs? But this should be prevented setting the option "Export with Debug" on "Export Project..." right?

gumaciel commented 1 year ago

Mobile Ads SDK Forum Advisor With regard to your concern for error code 3, it means that the ad request was successful, but no ad was returned due to lack of ad inventory.

https://groups.google.com/g/google-admob-ads-sdk/c/1Q9rRNVAKYo#:~:text=Mobile%20Ads%20SDK%20Forum%20Advisor,-unread%2C&text=With%20regard%20to%20your%20concern,to%20lack%20of%20ad%20inventory.


This should not be a problem with your integration, it's a problem with AdMob server

Btw, are you using the sample APP ID to make the requests?

ca-app-pub-3940256099942544~3347511713

lucaleonardi commented 1 year ago

Yes, I'm using the APP ID you reported.

But how is the "ad inventory" involved while using testing unit IDs? The use of those IDs is deliberately for displaying test ads, which should not be provided by any ad inventory.

My concern is that, because the test project works, there could be something about my configuration that is wrong? It's basically the same, with the difference that I have the Keystore Release set, because the app is already on Google Play. What about the configuration in the AdMob Editor, should I modify something here?

gumaciel commented 1 year ago

The ad inventory is from AdMob server, they don't have some ads to display to you, as I can see, there's not wrong with your implementation or our plugin.

Please check if you are using UMP, if you are, click to consent, if you do not consent, the probability of not seeing an advertisement for you is greater

gumaciel commented 1 year ago

@lucaleonardi your problem still persist?

lucaleonardi commented 1 year ago

@gumaciel not anymore, thanks for checking. Apparently it was a temporary problem as you pointed out, because now the interstitial and the ads load correctly 👍

I close the issue, thanks.