Shin-NiL / Godot-Android-Admob-Plugin

Android AdMob plugin for Godot Game Engine 3.2 or higher
MIT License
544 stars 66 forks source link

Banner ads height? #75

Open mthnzbk opened 4 years ago

mthnzbk commented 4 years ago

Godot version: 3.2.2 AdMob Plugin version: latest Issue description: I posted the game, but the height of banner ads is still a problem for me. Isn't there a way to make it look thin like an FHD screen? https://ibb.co/d4mgkdq -> fhd+ or 720p https://ibb.co/BzCCtmd -> fhd

Shin-NiL commented 4 years ago

I'm afraid that's it the way that adaptive banners works. Maybe you should avoid use banners on screens where it can override some controls.

mthnzbk commented 4 years ago

then I shouldn't use banner ads on the game screen. There is no other way then.

joshzegers commented 4 years ago

@Shin-NiL I'm having this same issue for some users. I have never gotten one of these big banner ads on MY phone, but my friend (who has the same phone model as me) consistently gets them and only when using my app. I'm fairly certain it isn't an issue with adaptive banners because I've never seen an app with banner ads this tall. They are literally twice the size they should be; it is a serious impediment. According to the link on adaptive banners, it's supposed to make these ads take up a "more consistent portion of the screen across devices." That doesn't seem to be what's going on. This question raises a possible cause/solution.

Edit: if it is really just how adaptive banners are, what's the reason for using them? they are extremely ugly especially for game apps, which is the target audience for your otherwise great plugin. I think smart banners would be a better choice by far.

Shin-NiL commented 4 years ago

I've changed from smart banner to adaptive for basically two reasons:

  1. Adaptive banner are supposed to replace the smart banner according with AdMob docs;
  2. @mthnzbk was having the same issue with smart banner before and we thought it was solved, until now.

I can try to change the plugin to let the user specify the banner size manually, maybe it's the best solution.

mthnzbk commented 4 years ago

I didn't have much trouble with the test ads. I started having this problem on my wife and my own phone when I switched to real ads. Most likely, those who play have the same problem if the fhd is not the screen.

Shin-NiL commented 4 years ago

I have added the option to define the banner sizes, can you guys make a test?

GodotAdmobPlugin-4.1.0-pre.zip

tolgakaranlik commented 4 years ago

Man, that was a very helpful addition. Choosing banner size is a great enhancement. I was trying to build the whole source by myself for being able to achieve this. Now I am testing this new feature and will let you know the result

tolgakaranlik commented 4 years ago

As far as I can see, it works like charm. Keep up the good work man! I'll let you know if I find any bugs in my later usage

Shin-NiL commented 4 years ago

@tolgakaranlik Nice! Thank you for testing, if everything goes fine it'll be included in the next release.

ulvido commented 4 years ago

thank you good job. unfortunately I couldnt be able to see a difference. and also reset button does not respond well

Peek 2020-09-07 20-29

EXAMPLE FIX: export(String, "ADAPTIVE_BANNER", "SMART_BANNER", "BANNER", "LARGE_BANNER", "MEDIUM_RECTANGLE", "FULL_BANNER", "LEADERBOARD") var banner_size = "ADAPTIVE_BANNER"

Shin-NiL commented 4 years ago

unfortunately I couldnt be able to see a difference

Are you using the .aar and .gdap files from the version 4.1.0-pre of the plugin?

EXAMPLE FIX: export(String, "ADAPTIVE_BANNER", "SMART_BANNER", "BANNER", "LARGE_BANNER", "MEDIUM_RECTANGLE", "FULL_BANNER", "LEADERBOARD") var banner_size = "ADAPTIVE_BANNER"

Thank you @ulvido, I've just upload the fix.

ulvido commented 4 years ago

I thank you. first deleted the old ones and copied. also restarted the godot. ayway I get used to it now. I dont matter.

joshzegers commented 4 years ago

The update is not working for me as it is intended. So I switched to smart banners and, on the affected phones, it continued to display 320x100 banners. Next I tried "BANNERS" which are supposed to be a constant 320x50, which resulted in NO ads being displayed at all, including interstitial ads -- I am getting an Invalid Parameter error. The error only arrives in release, no error when debugging. update: retried the "BANNERS" option and it once again didn't display ads, but this time produced no errors with logcat

Shin-NiL commented 4 years ago

@joshzegers if it's working with the test mode and there's no error on release then I suspect that there's not much 320x50 ads to be served, maybe it's not a popular size. The publisher of the ad must distribute this size of banner to be served.

There's really no errors on logcat? If there was no ads to be served, as I suspected, then it should return error code 3.

joshzegers commented 4 years ago

I think there are plenty of ads in that size because that is typically all I see on my phone, it's just some random users only get the big ones. So if nothing shows up, including interstitial, then something in the admob plugin broke. I'm still debugging... I'll update with more news.

joshzegers commented 4 years ago

UPDATE: Having issues now just in general displaying normal ads in release. Test ads always show up no matter the banner size, no matter if debug or release. Real ads show in debug, NOT in release. Even smart_banners aren't working anymore. Part of the issue, I think, is problems with the signals. In the default admob.gd, it shows 12 signal connects that produce 12 errors if I leave them there, saying "signal X has already been connected to method Y" (in debug mode, but only if is_real is true. no errors if is_real is false in debug mode) and produced this error in release (with is_real of course being true): **ERROR**: Method failed. Returning: ERR_INVALID_PARAMETER E godot : At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID The connected methods seem to still be entered but only with the test ads (I had ads print whether the banner loaded or failed. Test ads printed that the banner loaded, while real ads printed nothing, not even the built-in outputs). If I comment out the signal connects, I am left with no errors, but the methods like _on_admob_ad_loaded() are never entered.

joshzegers commented 4 years ago

Update 2: I upgraded the version of the google play services in the .gdap file which helped somewhat. The errors persist still when in release mode or when I have is_real enabled in debug mode. The only thing that has been fixed is that now logcat shows error code 3 for whenever I try to load an ad when is_real is true (both in debug and release). But what doesn't make sense is that this happens for even adaptive banners and interstitial ads, for which my admob account has plenty of inventory (I can even see these ads being filled in the current release of my app).

Shin-NiL commented 4 years ago

@joshzegers are you using all files from the GodotAdmobPlugin-4.1.0-pre.zip package?

joshzegers commented 4 years ago

yes

Shin-NiL commented 4 years ago

@joshzegers was it working fine with v4.0.0?

Edit: are you testing your release binary after sign it with the production keystore?

joshzegers commented 4 years ago

4.0.0 worked, yes. That's what I had been using for a while and it worked. This newest update has just had some weird effects. I'm doing both internal testing and final releases as well, but those take like two days for the review, so it's harder to test. Would internal test be different from play store release?

Shin-NiL commented 4 years ago

Would internal test be different from play store release?

I really don't know, error code 3 can be caused for many, many different things. If you google search it you'll find various mismatched information.

Do you remember if you were able to display the real ads with debug build using plugin 4.0.0?

The only thing I've changed from 4.0.0 to 4.1.0 was a upgrade on the AdMob SDK.

tolgakaranlik commented 4 years ago

Well according to user10224828 at this StackOverflow post, you are able to get test ads but AdMob won't allow you to display real ads on your development environment. I know it was different in earlier versions but maybe they changed it in the last version. He seems pretty sure that you will be able to see those ads when the release distribution will be installed from Google Play. I will be trying it in a couple of days and will see the result. Sounds logical to me, I'll share the result here as soon as I see it

tolgakaranlik commented 4 years ago

It seems ads are working as intended when I compile my apk in release mode (without including debug information) and sign the app with my release key. But they don't work in debug mode (except test ads, there are no problems with the test ads). Most logical explanation here is that maybe the Google guys has blocked real ads display in debug mode.

Shin-NiL commented 4 years ago

Thank you for reporting @tolgakaranlik, I hope it works fine for everyone.

joshzegers commented 4 years ago

Internal test is not debug mode, but it's signed differently; I couldn't find info on it being an issue for ads. In 4.0.0 I didn't try to show real ads in debug mode. In this version I just tried it to help find my issue.

I can now report that adaptive banners, smart banners, and interstitial seem to be back to working order in my internal test, all I had to do was wait for whatever reason. However, the 12 errors still come up (they are just-for-show errors I guess and don't really hurt anything?). The issue of Smart banners displaying 320x100 ads is still a problem. I know this because I published using a test ad set to smart_banner and it said right on the ad that it was 320x100 even though the docs say nothing about smart_banners having that size of ad. I also tried BANNER and FULL_BANNER; neither displayed an ad and DID NOT print code 3 or anything like that -- nothing prints after the ad is requested. In the Stack Overflow question I linked in my first comment, they opted for this: android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" I think adding this would help since some of the 320x100 ads are actually more like 320x80 or 320x60 and fill in the rest with transparent pixels, but the layout makes it so that it centers it, putting half the transparent pixels below the ad. I've seen it many times in the affect users' phones.

UPDATE: I'm thinking that updating the version of GPS in the .gdap file may have fixed the issue with smart_banners showing 320x100 ads. Would be a much faster debug process if I was the one having the issues, but I've gotta wait for other people's feedback.

Shin-NiL commented 4 years ago

the 12 errors still come up

What are these errors?

I'm thinking that updating the version of GPS in the .gdap file may have fixed

The GPS version on 4.1.0 is already upgraded to 19.3.0. I've coded this version of the plugin using 19.3.0 and it must match or you can get some strange behaviors.

I can't touch the layout configuration as it's defined on the engine, it's not created by me.

joshzegers commented 4 years ago

The 12 errors I described:

In the default admob.gd, there are 12 signal connects that produce 12 errors if I leave them there, saying something like "signal X has already been connected to method Y" (in debug mode, but only if is_real is true. no errors if is_real is false in debug mode). In release (with is_real of course being true) I instead get the following error 12 times: **ERROR**: Method failed. Returning: ERR_INVALID_PARAMETER E godot : At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID

And when I downloaded the 4.1.0, I didn't change the dependencies in the gdap file because I had some stuff in there I didn't want to mess with. I previously had my GPS at 19.1.0. But it's fine now, no big deal.

martinpelli commented 3 years ago

The 12 errors I described:

In the default admob.gd, there are 12 signal connects that produce 12 errors if I leave them there, saying something like "signal X has already been connected to method Y" (in debug mode, but only if is_real is true. no errors if is_real is false in debug mode). In release (with is_real of course being true) I instead get the following error 12 times: **ERROR**: Method failed. Returning: ERR_INVALID_PARAMETER E godot : At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID

And when I downloaded the 4.1.0, I didn't change the dependencies in the gdap file because I had some stuff in there I didn't want to mess with. I previously had my GPS at 19.1.0. But it's fine now, no big deal.

I have the same errors when updating to 3.2.3

09-19 16:15:55.373   934  1028 E godot   : **ERROR**: Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   : **ERROR**: Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   : **ERROR**: Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   : **ERROR**: Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   : **ERROR**: Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   : **ERROR**: Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   : **ERROR**: Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   : **ERROR**: Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   : **ERROR**: Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   : **ERROR**: Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   : **ERROR**: Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   : **ERROR**: Method failed. Returning: ERR_INVALID_PARAMETER
09-19 16:15:55.374   934  1028 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER

on 3.2.2 this didn´t happened @Shin-NiL

joshzegers commented 3 years ago

Another update: The smart banners were working for a short time and are now back to showing the big 320x100 ads on affected devices.

Also, I've been using Godot 3.2.2.

Shin-NiL commented 3 years ago

@martinpelli did you update all plugin files (.gdap, .aar and admob-lib folder)?

The AdMob plugin 4.1.0 was compiled using Godot 3.2.3 files, I don't know if it will work well with 3.2.2.

martinpelli commented 3 years ago

@Shin-NiL yes I do it all again and the game works great but whit the logcat I get those errors. With godot 3.2.2 I dont have the errors, whit godot 3.2.3 I have the errors

martinpelli commented 3 years ago

@Shin-NiL


09-20 22:08:57.832 29750 29903 E godot   : **ERROR**: Signal 'on_admob_ad_loaded' is already connected to given method '_on_admob_ad_loaded' in that object.
09-20 22:08:57.832 29750 29903 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
09-20 22:08:57.832 29750 29903 E godot   : **ERROR**: Signal 'on_rewarded_video_ad_loaded' is already connected to given method '_on_rewarded_video_ad_loaded' in that object.
09-20 22:08:57.832 29750 29903 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
09-20 22:08:57.832 29750 29903 E godot   : **ERROR**: Signal 'on_rewarded_video_ad_closed' is already connected to given method '_on_rewarded_video_ad_closed' in that object.
09-20 22:08:57.832 29750 29903 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
09-20 22:08:57.832 29750 29903 E godot   : **ERROR**: Signal 'on_rewarded' is already connected to given method '_on_rewarded' in that object.
09-20 22:08:57.832 29750 29903 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
09-20 22:08:57.832 29750 29903 E godot   : **ERROR**: Signal 'on_rewarded_video_ad_left_application' is already connected to given method '_on_rewarded_video_ad_left_application' in that object.
09-20 22:08:57.832 29750 29903 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
09-20 22:08:57.832 29750 29903 E godot   : **ERROR**: Signal 'on_rewarded_video_ad_failed_to_load' is already connected to given method '_on_rewarded_video_ad_failed_to_load' in that object.
09-20 22:08:57.832 29750 29903 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
09-20 22:08:57.832 29750 29903 E godot   : **ERROR**: Signal 'on_rewarded_video_ad_opened' is already connected to given method '_on_rewarded_video_ad_opened' in that object.
09-20 22:08:57.832 29750 29903 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
09-20 22:08:57.832 29750 29903 E godot   : **ERROR**: Signal 'on_rewarded_video_started' is already connected to given method '_on_rewarded_video_started' in that object.
09-20 22:08:57.832 29750 29903 E godot   :    At: core/object.cpp:1515:connect() - Method failed. Returning: ERR_INVALID_PARAMETER
Shin-NiL commented 3 years ago

@martinpelli I can't get this errors using the demo project. Are you having two or more instances of the AdMob node alive at same time?

martinpelli commented 3 years ago

@martinpelli I can't get this errors using the demo project. Are you having two or more instances of the AdMob node alive at same time?

on same scene no. I have the admob node on different scenes. And the erros says that the signal is already connected to given method so maybe is because I haave one admob on level 1, other admob node on level 2, other on level 3?

Shin-NiL commented 3 years ago

@martinpelli I can't reproduce the issue, even adding two AdMob nodes on the same scene :( It seems like for unknown reason there are more than one AdMob node being added to the scene, so the signal is already connected.

Could you try to add this lines on the AdMob.gd?

func _exit_tree():
    self.queue_free()

To try to free the node and clean the previous node connection.

If you can create a small test case project with this issue maybe I could find the cause.

Another thing, could you please create a new issue (you can simply copy & paste your text there)? This has nothing to do with the banner size anymore.

martinpelli commented 3 years ago

@martinpelli I can't reproduce the issue, even adding two AdMob nodes on the same scene :( It seems like for unknown reason there are more than one AdMob node being added to the scene, so the signal is already connected.

Could you try to add this lines on the AdMob.gd?

func _exit_tree():
  self.queue_free()

To try to free the node and clean the previous node connection.

If you can create a small test case project with this issue maybe I could find the cause.

Another thing, could you please create a new issue (you can simply copy & paste your text there)? This has nothing to do with the banner size anymore.

I put that func on the admob script and I keep getting the same, I discovered that the errors only appear when I check de is real box on the admob editor, I will tru to reproduce the error in other project but I think that is a problem of my project, but I dont understand why ist work well on 3.2.2 , actually I have a game with your plugin on play store, And traying to update it to 3.2.3 on godot I am getting this

Shin-NiL commented 3 years ago

but I dont understand why ist work well on 3.2.2 , actually I have a game with your plugin on play store, And traying to update it to 3.2.3 on godot I am getting this

There was a change behind the scenes between AdMob plugin 4.0.0 and 4.1.0, it now emit signals on the java code. It can be the cause. I'll try make some tests using is_real = true.

martinpelli commented 3 years ago

but I dont understand why ist work well on 3.2.2 , actually I have a game with your plugin on play store, And traying to update it to 3.2.3 on godot I am getting this

There was a change behind the scenes between AdMob plugin 4.0.0 and 4.1.0, it now emit signals on the java code. It can be the cause. I'll try make some tests using is_real = true.

I solved. I made a backup of my old game on 3.2.2 and then I upadated the android build template and the export templated to 3.2.3 and works perfeclty, the problem was when I was remplacing the admob lib folder or the gda files.

But today ,later . I will try to create a new project to see if the problem is when updating the plugin or if it happening on a new project too

Shin-NiL commented 3 years ago

I solved. I made a backup of my old game on 3.2.2 and then I upadated the android build template and the export templated to 3.2.3 and works perfeclty, the problem was when I was remplacing the admob lib folder or the gda files.

So you're not getting the signal errors even with is_real = true anymore?

martinpelli commented 3 years ago

I solved. I made a backup of my old game on 3.2.2 and then I upadated the android build template and the export templated to 3.2.3 and works perfeclty, the problem was when I was remplacing the admob lib folder or the gda files.

So you're not getting the signal errors even with is_real = true anymore?

No, but I didn’t update the plugin, I am using 4.0.0

bitmagine commented 3 years ago

A solution could be to delete the "Android" folder and re-modify "manifest.xml" and copy the plugin back to your "plugins" folder??

martinpelli commented 3 years ago

A solution could be to delete the "Android" folder and re-modify "manifest.xml" and copy the plugin back to your "plugins" folder??

Yeah but plugin 4.0.0 version. So I deleted the android folder, installed android build template and export template for 3.2.3 and paste the admob plugin 4.0.0 again and that works (with paste the plugin again I mean to paste the admob-lib folder on root and the gdap, aar files on android/plugins) and modify the xml with your ID

Shin-NiL commented 3 years ago

@martinpelli I've just released version 4.1.1 that should fix the signal connection errors.

martinpelli commented 3 years ago

@martinpelli I've just released version 4.1.1 that should fix the signal connection errors.

Working now thanks!!!