@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(savedInstanceState == null) {
// Initialize Leadbolt SDK with your api key
AppTracker.startSession(getApplicationContext(),"YOUR_APP_API_KEY",AppTracker.ENABLE_AUTO_CACHE);
}
// cache Leadbolt Ad without showing it
AppTracker.loadModuleToCache(getApplicationContext(),"inapp");
}
public void gameOver() {
// call this when you want to display the Leadbolt Interstitial
if(AppTracker.isAdReady("inapp")) {
AppTracker.loadModule(getApplicationContext(),"inapp");
}
}
}
AppTracker.setAgeRange("18-25");
// Allowed values for Age range are: "13-17", "18-25", "26-35", "36-45", "46+"
private AppModuleListener leadboltListener = new AppModuleListener() {
@Override
public void onModuleLoaded(String location) {
// Add code here to pause game and/or all media including audio
}
@Override
public void onModuleFailed(String location, String error, boolean isCache) {}
@Override
public void onModuleClosed(String location) {
// Add code here to resume game and/or all media including audio
}
@Override
public void onModuleClicked(String location) {}
@Override
public void onModuleCached(String location) {
// Add code if not auto-recaching for when loadModuleModuleToCache is successful
}
@Override
public void onMediaFinished(boolean viewCompleted) {
if(viewCompleted) {
Log.i("AppTracker", "User finished watching rewarded video");
} else {
Log.i("AppTracker", "User skipped watching rewarded video");
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(savedInstanceState == null) {
// Initialize Leadbolt SDK with your api key
AppTracker.setModuleListener(leadboltListener);
AppTracker.startSession(getApplicationContext(),"YOUR_APP_API_KEY",AppTracker.ENABLE_AUTO_CACHE);
}
// cache Leadbolt Video Ad without showing it
AppTracker.loadModuleToCache(getApplicationContext(),"video");
}
public void gameOver() {
// call this when you want to display the Leadbolt Video
if(AppTracker.isAdReady("video")) {
AppTracker.loadModule(getApplicationContext(),"video");
}
}
}
1
2
3
4
5
AppTracker.setAgeRange("18-25");
// Allowed values for Age range are: "13-17", "18-25", "26-35", "36-45", "46+"
AppTracker.setGender("Female");
// Allowed values for Gender are: "Male", "Female"
private AppModuleListener leadboltListener = new AppModuleListener() {
@Override
public void onModuleLoaded(String location) {
Log.i("AppTracker", "Ad loaded successfully - "+location);
// Add code here to pause game and/or all media including audio
}
@Override
public void onModuleFailed(String location, String error, boolean isCache) {
if(isCache) {
Log.i("AppTracker", "Ad failed to cache - "+location);
} else {
Log.i("AppTracker", "Ad failed to display - "+location);
}
}
@Override
public void onModuleClosed(String location) {
Log.i("AppTracker", "Ad closed by user - "+location);
// Add code here to resume game and/or all media including audio
}
@Override
public void onModuleClicked(String location) {
Log.i("AppTracker", "Ad clicked by user - "+location);
}
@Override
public void onModuleCached(String location) {
Log.i("AppTracker", "Ad cached successfully - "+location);
// Add code if not auto-recaching for when loadModuleModuleToCache is successful
}
@Override
public void onMediaFinished(boolean viewCompleted) {
if(viewCompleted) {
Log.i("AppTracker", "User finished watching rewarded video");
} else {
Log.i("AppTracker", "User skipped watching rewarded video");
}
}
};
import com.apptracker.android.listener.AppModuleListener; import com.apptracker.android.track.AppTracker; // Leadbolt SDK imports
public class MainActivity extends Activity {
} AppTracker.setAgeRange("18-25"); // Allowed values for Age range are: "13-17", "18-25", "26-35", "36-45", "46+"
AppTracker.setGender("Female"); // Allowed values for Gender are: "Male", "Female" 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 import com.apptracker.android.listener.AppModuleListener; import com.apptracker.android.track.AppTracker; // Leadbolt SDK imports
public class MainActivity extends Activity {
}
1 2 3 4 5 AppTracker.setAgeRange("18-25"); // Allowed values for Age range are: "13-17", "18-25", "26-35", "36-45", "46+"
AppTracker.setGender("Female"); // Allowed values for Gender are: "Male", "Female" private AppModuleListener leadboltListener = new AppModuleListener() { @Override public void onModuleLoaded(String location) { Log.i("AppTracker", "Ad loaded successfully - "+location); // Add code here to pause game and/or all media including audio } @Override public void onModuleFailed(String location, String error, boolean isCache) { if(isCache) { Log.i("AppTracker", "Ad failed to cache - "+location); } else { Log.i("AppTracker", "Ad failed to display - "+location); } } @Override public void onModuleClosed(String location) { Log.i("AppTracker", "Ad closed by user - "+location); // Add code here to resume game and/or all media including audio } @Override public void onModuleClicked(String location) { Log.i("AppTracker", "Ad clicked by user - "+location); } @Override public void onModuleCached(String location) { Log.i("AppTracker", "Ad cached successfully - "+location); // Add code if not auto-recaching for when loadModuleModuleToCache is successful } @Override public void onMediaFinished(boolean viewCompleted) { if(viewCompleted) { Log.i("AppTracker", "User finished watching rewarded video"); } else { Log.i("AppTracker", "User skipped watching rewarded video"); } } };
2 AppTracker.setModuleListener(leadboltListener); AppTracker.startSession(getApplicationContext(),"YOUR_APP_API_KEY",AppTracker.ENABLE_AUTO_CACHE);