Leadbolt Interstiltial support for Android
Posted: Tue Feb 23, 2016 8:33 pm
So, there is a topic about AdMob support...
But I don't use AdMob mainly because of the ways it provides me to get my money.
I'm not here to advertise anything but to give back and share with what I've learned.
Note that I don't use banners yet, so no support for those.
I'm also aware that one can integrate many ads SDKs using AdMob account, but I didn't want another "proxy" which probably will claim it's share... I'm just to lazy to setup another integration.
So...
What one will need to achieve interstitial from Leadbolt:
1. Register an account at Leadbolt
2. Get Leadbolt's SDK
3. Copy AppTracker.jar from the SDK to the "libs" folder of your project
4. Integrate google_services_lib into your project (can be a little bit tricky, but it's better to get how to do it on one's own)
5. Follow this thread to add methods for Interstitials support from AdMob
6. Change the "src/GameActivity.java" file a bit:
a) Inside "onCreate" after "getWindowManager().getDefaultDisplay().getMetrics(metrics);" add this:
b) Change the "isInterstitialLoaded" method to look like this
c) Change the "showInterstitial" method to look like this
After that one should be able to call to display interstitiall.
It may well be that I've coded something/most/all in a wrong way, but hey! I'm not a java programmer and the code above is working for me
Any criticism on the code is welcomed.
But I don't use AdMob mainly because of the ways it provides me to get my money.
I'm not here to advertise anything but to give back and share with what I've learned.
Note that I don't use banners yet, so no support for those.
I'm also aware that one can integrate many ads SDKs using AdMob account, but I didn't want another "proxy" which probably will claim it's share... I'm just to lazy to setup another integration.
So...
What one will need to achieve interstitial from Leadbolt:
1. Register an account at Leadbolt
2. Get Leadbolt's SDK
3. Copy AppTracker.jar from the SDK to the "libs" folder of your project
4. Integrate google_services_lib into your project (can be a little bit tricky, but it's better to get how to do it on one's own)
5. Follow this thread to add methods for Interstitials support from AdMob
6. Change the "src/GameActivity.java" file a bit:
a) Inside "onCreate" after "getWindowManager().getDefaultDisplay().getMetrics(metrics);" add this:
Code: Select all
// Leadbolt Intestitial -- got from https://help.leadbolt.com/android-integration-guide/
if(savedInstanceState == null) {
// Initialize Leadbolt SDK with your api key
AppTracker.startSession(getApplicationContext(),"<ads ID>");
}
// cache Leadbolt Ad without showing it
AppTracker.loadModuleToCache(getApplicationContext(),"inapp");
Code: Select all
public boolean isInterstitialLoaded() {
Log.d("GameActivity", "Calling isInterstitialLoaded");
adLoaded = AppTracker.isAdReady("inapp");
return adLoaded;
}
c) Change the "showInterstitial" method to look like this
Code: Select all
public void showInterstitial() {
Log.d("GameActivity", "Showing ad!");
if(AppTracker.isAdReady("inapp")) {
AppTracker.loadModule(getApplicationContext(),"inapp");
}
}
Code: Select all
love.system.showInterstitial()
It may well be that I've coded something/most/all in a wrong way, but hey! I'm not a java programmer and the code above is working for me
Any criticism on the code is welcomed.