[11.3] AdMob support for Android + EU Consent

Showcase your libraries, tools and other projects that help your fellow love users.
KallioSanteri
Prole
Posts: 19
Joined: Tue Jan 14, 2020 5:04 pm

Re: [11.3] AdMob support for Android + EU Consent

Post by KallioSanteri »

Hey bio1712!

As I'm sort of lazy with programming, I tend to program a lot for some time and then just quit for a while. I had a new design idea and wanted to start programming. I thought I got the library and Love 11.3 safeArea working last time with your help, but it turns out it wasn't actually quite the case. It was just by luck that it fit the safe area perfectly, and height and safeAreaHeight is the exactly same thing when it comes to programming with the current setup. In my current files, line 98 is uncommented. I am not sure which one it is in the version that I actually have installed on my phone. Anyways, the safe area doesn't work, and if I understand correctly, it has been fixed to work in the development version of 11.3. So, my point is, do you have any plans to update this amazing project to the development release? I know it's probably not as stable, but at least the issue seems to be fixed? and 11.4 is probably quite far away from today. I don't mean to pressure you by any means to update the project if you're not willing to, but I just decided to ask, as the latest development version seems to be working. If you decide to update, I am of course willing to help, but I am not very good with Android projects in general, so I don't know would I be able to do much. Anyways, I just thought I would ask, as this project updated to the development version before 11.4 is released would be amazing.

-Santeri
bio1712
Citizen
Posts: 72
Joined: Wed Aug 19, 2015 4:13 pm
Location: Italy

Re: [11.3] AdMob support for Android + EU Consent

Post by bio1712 »

KallioSanteri wrote: Fri Apr 24, 2020 12:28 pm Hey bio1712!

As I'm sort of lazy with programming, I tend to program a lot for some time and then just quit for a while. I had a new design idea and wanted to start programming. I thought I got the library and Love 11.3 safeArea working last time with your help, but it turns out it wasn't actually quite the case. It was just by luck that it fit the safe area perfectly, and height and safeAreaHeight is the exactly same thing when it comes to programming with the current setup. In my current files, line 98 is uncommented. I am not sure which one it is in the version that I actually have installed on my phone. Anyways, the safe area doesn't work, and if I understand correctly, it has been fixed to work in the development version of 11.3. So, my point is, do you have any plans to update this amazing project to the development release? I know it's probably not as stable, but at least the issue seems to be fixed? and 11.4 is probably quite far away from today. I don't mean to pressure you by any means to update the project if you're not willing to, but I just decided to ask, as the latest development version seems to be working. If you decide to update, I am of course willing to help, but I am not very good with Android projects in general, so I don't know would I be able to do much. Anyways, I just thought I would ask, as this project updated to the development version before 11.4 is released would be amazing.

-Santeri

Hi!
Today I tried to update the Library to this release, however it didn't fix the problem.

Therefore, this issue is probably caused by something in AdActivity.java.
However, I've added these two lines

Code: Select all

getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
and with them the behaviour seems to be similar to the original release.

I've uploaded the new GameActivity.java to the Bitbucket repository.

Here is the library updated to the Github release.
I think it needs a little bit of testing, before uploading it to Bitbucket.

Let me know!
KallioSanteri
Prole
Posts: 19
Joined: Tue Jan 14, 2020 5:04 pm

Re: [11.3] AdMob support for Android + EU Consent

Post by KallioSanteri »

bio1712 wrote: Sat Apr 25, 2020 1:49 pm
KallioSanteri wrote: Fri Apr 24, 2020 12:28 pm Hey bio1712!

As I'm sort of lazy with programming, I tend to program a lot for some time and then just quit for a while. I had a new design idea and wanted to start programming. I thought I got the library and Love 11.3 safeArea working last time with your help, but it turns out it wasn't actually quite the case. It was just by luck that it fit the safe area perfectly, and height and safeAreaHeight is the exactly same thing when it comes to programming with the current setup. In my current files, line 98 is uncommented. I am not sure which one it is in the version that I actually have installed on my phone. Anyways, the safe area doesn't work, and if I understand correctly, it has been fixed to work in the development version of 11.3. So, my point is, do you have any plans to update this amazing project to the development release? I know it's probably not as stable, but at least the issue seems to be fixed? and 11.4 is probably quite far away from today. I don't mean to pressure you by any means to update the project if you're not willing to, but I just decided to ask, as the latest development version seems to be working. If you decide to update, I am of course willing to help, but I am not very good with Android projects in general, so I don't know would I be able to do much. Anyways, I just thought I would ask, as this project updated to the development version before 11.4 is released would be amazing.

-Santeri

Hi!
Today I tried to update the Library to this release, however it didn't fix the problem.

Therefore, this issue is probably caused by something in AdActivity.java.
However, I've added these two lines

Code: Select all

getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
and with them the behaviour seems to be similar to the original release.

I've uploaded the new GameActivity.java to the Bitbucket repository.

Here is the library updated to the Github release.
I think it needs a little bit of testing, before uploading it to Bitbucket.

Let me know!
Hi!

I'm glad you decided to go with the update. After few problems in the beginning, like Android NDK not accepting a space in my external HDD's name and changing the gradlew file to use the correct UNIX line-endings instead of the Windows ones, it built just fine.

When starting my in-progress app with this new build, I immediately noticed that the navigation bar had a transparent background instead of the black one that the previous version had. I actually aimed for the transparent version, but never got it working before so I stuck with the black background. The safe area works well with the notch in my phone, although I noticed a one pixel difference in the actual location of the notch and the safe area. It could be just a bug with the physical display, as with this replacement display it has a weird bug where sometimes when starting the device, a row of pixels is mirrored from the right side to the very left. Super weird. I will attach a screenshot, even though it will not obviously show the notch. The red bar in the screenshot is drawn where the notch starts, as I intended for testing purposes. The text in the top left corner which has two values represents the screen height and safe area height after dpi scale. Previously it was not working, now it is with this new build. The text is a bit too low, but I am sure it's only the font, as the text even higher than that is drawn at 0,0 and still a bit too low, and the rectangle is displayed correctly in its intended position (Minus the one pixel difference).

I disabled the ads for testing, as I was going to change the banner type later on. However, I enabled the default banner just to see if the safe area would still work, and sure enough it does, but at the same time I realized that the software navigation lays on top of the ad. Could that be a problem for Google? And why are the buttons and the title bar actually transparent? I tweaked the settings on the previous project, but there is no way those settings would have made it over to the updated version, as I never combined the folders or anything? I will look into the theme settings just a bit more to see if they have any impact on the navigation and title bar being transparent, and if making the background black will make the ad move above the navigation.

In conclusion, I would like to hear your opinion on the software buttons displaying on top of the ad banner, and if that's something to worry about? Also, before publishing, you should probably change the UNIX gradlew file to have UNIX line-endings, as they apparently got changed when you saved the file on your Windows workstation. Other than that, you have definitely made great progress, and it's great to be able to use this library.

PS: I actually tested where the safe area ends, and while the navigation bar has a transparent background, it is included in the safe area, as I expected. I will test the black background on the navigation bar later on. Also, about the one pixel difference in the notch location and the safe area Y (safe area is one pixel too up). When I draw the rectangle to reach all the way to the very end of the safe area, it ends just one pixel shy. So, it get's the safe area height correctly, but the starting point is just a bit off. I tried to restart my device but it made no difference. I don't know whether it's the device or the code, I will test the safe area functionality with other devices with notches that I can get my hands on.

PS 2: I just realized that I actually don't know if the safe area is one pixel off or a few, I just sort of assumed it was one pixel. This info probably didn't matter, just wanted to throw it in.

Sorry for the long text and thank you for the amazing work you have done with the library,

Santeri
Attachments
Screenshot_20200503-220442.png
Screenshot_20200503-220442.png (234.88 KiB) Viewed 32486 times
jadius93
Prole
Posts: 3
Joined: Mon May 11, 2020 2:46 pm

Re: [0.10.2] AdMob support for Android!

Post by jadius93 »

yetneverdone wrote: Sun Dec 17, 2017 1:35 pm
Hey, ive forked your repo and added my instruction/guide in the wiki here: https://bitbucket.org/brbl/love2d-admob ... nstruction
IDK how to PR that, please have a look at it before i make any more updates
Hi,

The guide is really clear and easy to follow. Great job to all who have contributed to this, and thanks a lot for sharing your wisdom! :megagrin:

I am an amateur programmer (if I can even call myself that) and I am facing some problems with the gradlew build. I guess it is something to do with the Java/Gradle version compatibility, but I can't seem to find a right answer.

I get the following error when running gradlew build:

Code: Select all

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '14.0.1'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org
I have installed the latest JDK version (SE14) and the latest Gradle version (6.4.1). I even tried an older version of Gradle (6.0) but also no luck getting it work. I unfortunately cannot download an older version of JDK to try it out without creating an Oracle account, which I would like to somehow avoid..

Any help would be greatly appreciated! :)

Cheers!
User avatar
Gunroar:Cannon()
Party member
Posts: 1142
Joined: Thu Dec 10, 2020 1:57 am

Re: [11.3] AdMob support for Android + EU Consent

Post by Gunroar:Cannon() »

Err.... When I try the download link for bitbucket it says "link has no power here", pls help? How do I fix this?
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
uriid1
Prole
Posts: 10
Joined: Thu Jan 14, 2021 4:16 pm

Re: [11.3] AdMob support for Android + EU Consent

Post by uriid1 »

Hello everybody. For some reason I am getting the error:
Image

I have already compiled github.com/love2d/love-android
and successfully. My game started up and work. I did everything according to instructions.

I tried the same with different Ndk 16.1.4479499, 19.2.5345600, 21.1.6352462, 21.3.6528147, 22.1.7171670

But it did not help.
I also tried to play with the settings and did the signed apk.

My phone is 10 android.

Oddly enough, apk is 3.0mb in size.

UPD: I did everything from the beginning and I succeeded.
I don't know what the mistake was.
Amanda-Fl
Prole
Posts: 1
Joined: Sat Jul 10, 2021 12:38 pm

Re: [11.3] AdMob support for Android + EU Consent

Post by Amanda-Fl »

Hi there,

First off, thanks for doing this!

I am having difficulty implementing it though. Doing the test Gradle build from the command-line, the build is failing with a Java.lang.nullPointerException when going through the love section. No expansion on that error is given, even with a full Gradle scan.

Any thoughts?

I have loaded the project up on Android Studio, so I can generate a .aab from there for Google Play Console. The same error shows there as well.
User avatar
yetneverdone
Party member
Posts: 448
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: [11.3] AdMob support for Android + EU Consent

Post by yetneverdone »

bio1712 wrote: Sat Apr 25, 2020 1:49 pm
KallioSanteri wrote: Fri Apr 24, 2020 12:28 pm Hey bio1712!

As I'm sort of lazy with programming, I tend to program a lot for some time and then just quit for a while. I had a new design idea and wanted to start programming. I thought I got the library and Love 11.3 safeArea working last time with your help, but it turns out it wasn't actually quite the case. It was just by luck that it fit the safe area perfectly, and height and safeAreaHeight is the exactly same thing when it comes to programming with the current setup. In my current files, line 98 is uncommented. I am not sure which one it is in the version that I actually have installed on my phone. Anyways, the safe area doesn't work, and if I understand correctly, it has been fixed to work in the development version of 11.3. So, my point is, do you have any plans to update this amazing project to the development release? I know it's probably not as stable, but at least the issue seems to be fixed? and 11.4 is probably quite far away from today. I don't mean to pressure you by any means to update the project if you're not willing to, but I just decided to ask, as the latest development version seems to be working. If you decide to update, I am of course willing to help, but I am not very good with Android projects in general, so I don't know would I be able to do much. Anyways, I just thought I would ask, as this project updated to the development version before 11.4 is released would be amazing.

-Santeri

Hi!
Today I tried to update the Library to this release, however it didn't fix the problem.

Therefore, this issue is probably caused by something in AdActivity.java.
However, I've added these two lines

Code: Select all

getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
and with them the behaviour seems to be similar to the original release.

I've uploaded the new GameActivity.java to the Bitbucket repository.

Here is the library updated to the Github release.
I think it needs a little bit of testing, before uploading it to Bitbucket.

Let me know!
link to the google drive is not working, it's showing 404

EDIT
Im starting to update this to work with the latest love-android lib. Link is https://github.com/flamendless/love-android/tree/admob
User avatar
yetneverdone
Party member
Posts: 448
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: [11.3] AdMob support for Android + EU Consent

Post by yetneverdone »

Hi everyone. Managed to get this updated to the latest love (11.3 as of now).

Please check out: https://github.com/flamendless/love-android-admob

NOTE that as of now:
* the consent manager is still updated since I have to upgrade to User Messaging Platform as the previous one has been deprecated by Google.
* Interstitial and RewardedAd crashes the app at runtime. this is now fixed

I'll fix the issues and update it soon.
Last edited by yetneverdone on Sun Oct 17, 2021 11:14 am, edited 2 times in total.
User avatar
Gunroar:Cannon()
Party member
Posts: 1142
Joined: Thu Dec 10, 2020 1:57 am

Re: [11.3] AdMob support for Android + EU Consent

Post by Gunroar:Cannon() »

Really nice. To bad I quit my dreams of An Android admob game :cry: :P
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 1 guest