Need help integrating leadbolt ads into a paid for template [message #1450569] |
Wed, 22 October 2014 11:35  |
Eclipse User |
|
|
|
I have been trying to do this for over a week now and have searched high and low on how to integrate leadbolt ads into my app.
I bought an android app template and I want to add leadbolt ads to this source code.
I followed all the steps on the leadbolt page(sorry cannot post urls yet) and am lost on step 4.
This is the sample code I need to integrate with the attached java file.
/*
Other imports here
*/
import com.appfireworks.android.listener.AppModuleListener;
import com.appfireworks.android.track.AppTracker;
import com.YOUR_SDK_PACKAGE_NAME.AdController;
public class MainActivity extends Activity
{
private AdController interstitial;
private AdController audioad;
private Activity act = this;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(savedInstanceState == null) {
initializeLeadBolt();
}
}
private void initializeLeadBolt() {
audioad = new AdController(act, "YOUR_LB_AUDIO_ID");
audioad.loadAudioAd();
AppTracker.startSession(act, "APPFIREWORKS_API_KEY", new AppModuleListener() {
@Override
public void onModuleLoaded() {}
@Override
public void onModuleFailed() {
loadDisplayAd();
}
@Override
public void onModuleClosed() {}
@Override
public void onModuleCached() {}
});
}
private void loadDisplayAd() {
// use this else where in your app to load a Leadbolt Interstitial Ad
interstitial = new AdController(act, "YOUR_LB_INTERSTITIAL_ID");
interstitial.loadAd();
}
public void onPause() {
super.onPause();
if (!isFinishing()) {
AppTracker.pause(getApplicationContext());
}
}
public void onResume() {
super.onResume();
AppTracker.resume(getApplicationContext());
}
public void onDestroy() {
super.onDestroy();
if(isFinishing()) {
AppTracker.closeSession(getApplicationContext(), true);
}
if(audioad != null) {
audioad.destroyAd();
}
if(interstitial != null) {
interstitial.destroyAd();
}
}
}
The problem I am having is that on my main_activity java page it already has some of the same code as what is mentioned in the sample code page. So I am unsure how I can merge the code without causing errors.
I know that I cannot just copy and paste this into the bottom of my java file. I also tried taking different code from sections and placing them in sections that were the same in my java file and still that did not work.
I can include a copy of my main_activity java page so that hopefully someone can help me accomplish my goal.
I have added all the files needed to the lib folder and have the two permission in my android manifest file. I just need help to add the ad serving code.
I have attached the java file that needs the ads integrated.
Thanks in advance for any help.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.09398 seconds