Page 1 of 2

Admob Banner and Interstitial Support

Posted: Mon Dec 28, 2015 11:59 pm
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 ;)

Re: Admob Banner Support

Posted: Tue Dec 29, 2015 1:05 am
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.

Re: Admob Banner Support

Posted: Tue Dec 29, 2015 1:43 am
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.

Re: Admob Banner Support

Posted: Tue Dec 29, 2015 3:41 am
by vitail
i have been waiting this for long time, thanks!

Re: Admob Banner Support

Posted: Sun Jan 03, 2016 6:23 am
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

Re: Admob Banner Support

Posted: Sun Jan 03, 2016 8:46 am
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

Re: Admob Banner Support

Posted: Sun Jan 03, 2016 10:37 pm
by bio1712
This is awesome! Thank you!

Re: Admob Banner Support

Posted: Mon Jan 04, 2016 5:07 am
by master both
bio1712 wrote:This is awesome! Thank you!
Thanks!
And thank you for letting me use your code! :)

Re: Admob Banner and Interstitial Support

Posted: Tue Jan 05, 2016 12:46 pm
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

Re: Admob Banner and Interstitial Support

Posted: Tue Jan 05, 2016 12:55 pm
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)