在Android应用中实施多个插页式广告

时间:2015-01-02 11:26:04

标签: leadbolt

我想在我的应用中实施多个广告。我该怎么做?我在LeadBolt页面添加了一个广告,但我不确定要添加到我的应用程序的代码。

有没有办法每隔30到60秒添加第二个广告或刷新当前广告?

这是我的代码:

 private void initializeLeadBolt() {
    audioad = new AdController(act, "YOUR_LB_AUDIO_ID");
    audioad.loadAudioAd();
    AppTracker.startSession(act, "YOUR_....", 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, "");
    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();
    }

1 个答案:

答案 0 :(得分:0)

假设您使用Leadbolt SDK来展示广告......

要显示另一个Leadbolt广告,只需使用新创建的部分ID初始化新的AdController实例,例如:

AdController interstitial2 = new AdController(act, “LB_INTERSTITIAL_SECTION_ID”);
interstitial2.loadAd();