Admob Banner and Interstitial Support

A project to port LÖVE to Android handhelds
User avatar
master both
Party member
Posts: 262
Joined: Tue Nov 08, 2011 12:39 am
Location: Chile

Admob Banner and Interstitial Support

Post by master both »

Hi! Since I saw this great post: I have always wanted to try the same but with banners. So I did ;). You can get the source here: https://bitbucket.org/master_both/love-android-sdl2

Thanks to bio1712, it now supports Interstitial ads.

For getting this to work you will need to add google-play-services_lib to your project, which I can show you how.

I added 6 functions to love.system:
Banners:
•love.system.createBanner("Banner ID", "orentation") where orentation can be "top" or "bottom".
•love.system.hideBanner() removes the banner from the screen.
•love.system.showBanner() makes the banner reappear.
Interstitials:
•love.system.createInterstitial("Interstitial ID") create the interstitial ad.
•love.system.isInterstitialLoaded() check whether there is an ad loaded and ready to be shown.
•love.system.showInterstitial() show the ad.

You can get a "Banner ID" or "Interstitial ID" on the Admob website, they look like this:
ca-app-pub-9796530573307706/1938301675.

Adding google-play-services_lib without an IDE
For adding google-play-services_lib to your project you will first need to download it from the android-sdk by going to the "Android Sdk Manager" on "extras" and checking on "Google Play Services" then you can find the library folder on android_sdk/extras/google/google_play_services/libproject/google-play-services_lib. Now you have to paste it next to the project folder and execute "android update project -p 'dir/to/google-play-services_lib' " and you're done!

Now you can have full control of admob on lua!

Here you can get the apk: Link

Here you can see all the changes to the original repository that I made here:
https://bitbucket.org/master_both/love- ... aster#diff

Thanks again to bio1712 for making this possible :)

If anyone finds a bug please let me know ;)
Last edited by master both on Tue Jan 05, 2016 7:43 pm, edited 2 times in total.
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: Admob Banner Support

Post by bobbyjones »

Hey how good are you with Android stuff? I'm trying to understand your code so I can isolate it and maybe make a plugin architecture for Android. But I am not too good with Android or Java so idk what that entails.
User avatar
master both
Party member
Posts: 262
Joined: Tue Nov 08, 2011 12:39 am
Location: Chile

Re: Admob Banner Support

Post by master both »

bobbyjones wrote:Hey how good are you with Android stuff? I'm trying to understand your code so I can isolate it and maybe make a plugin architecture for Android. But I am not too good with Android or Java so idk what that entails.
um, actually I'm not that good with android, I just got most of the java code on google (thanks Stack Overflow) and completed some of the JNI stuff by looking at how functions like love.system.openURL or love.system.vibrate worked.
vitail
Prole
Posts: 26
Joined: Thu Apr 09, 2015 8:37 pm

Re: Admob Banner Support

Post by vitail »

i have been waiting this for long time, thanks!
teeter11
Prole
Posts: 27
Joined: Sun Jan 12, 2014 8:48 pm

Re: Admob Banner Support

Post by teeter11 »

sorry for noob question but how do i even open this on android studio?

i downloaded master_both-love-android-sdl2-bb0d84d0907e

thanks for the help i just dont understand any of this android stuff very well
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: Admob Banner Support

Post by bobbyjones »

Probably not the best to use Android studio. Would be easier to use cmdline to build and your preferred editor to edit the source files. To build you can follow the instructions from the android build repo's wiki along with the modifications he made.
https://bitbucket.org/MartinFelis/love- ... /wiki/Home
bio1712
Citizen
Posts: 72
Joined: Wed Aug 19, 2015 4:13 pm
Location: Italy

Re: Admob Banner Support

Post by bio1712 »

This is awesome! Thank you!
User avatar
master both
Party member
Posts: 262
Joined: Tue Nov 08, 2011 12:39 am
Location: Chile

Re: Admob Banner Support

Post by master both »

bio1712 wrote:This is awesome! Thank you!
Thanks!
And thank you for letting me use your code! :)
teeter11
Prole
Posts: 27
Joined: Sun Jan 12, 2014 8:48 pm

Re: Admob Banner and Interstitial Support

Post by teeter11 »

im confused at the part where you said Now you have to paste it next to the project folder and execute "android update project -p 'dir/to/google-play-services_lib' " and you're done!

what is android update project?

sorry for noob questions
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: Admob Banner and Interstitial Support

Post by bobbyjones »

Android is a cmd from the Android sdk. Android update project will prep the Google play services lib for inclusion in your app. (Or so that's what it seems like)
Locked

Who is online

Users browsing this forum: No registered users and 5 guests