我是InMobi的新用户我会在android studio中显示插页式广告,然后按照此操作 https://support.inmobi.com/monetize/android-guidelines/interstitial-ads-for-android/ 但是无法准确理解如何将其整合到活动线内的活动中?
有人给出例子 我想整合现有项目
InMobiInterstitial interstitialAd = new InMobiInterstitial(InterstitialAdsActivity.this, 1471550843414L, mInterstitialAdListener);
答案 0 :(得分:0)
在您的活动的oncreate()方法中添加以下代码:
InMobiInterstitial interstitial = new InMobiInterstitial(this, placement_id, new InMobiInterstitial.InterstitialAdListener2() {
@Override
public void onAdRewardActionCompleted(InMobiInterstitial ad, Map rewards) {}
@Override
public void onAdDisplayed(InMobiInterstitial ad) {
Log.d(TAG, "onAdDisplayed: ");
}
@Override
public void onAdDismissed(InMobiInterstitial ad) {
Log.d(TAG, "onAdDismissed: ");
}
@Override
public void onAdInteraction(InMobiInterstitial ad, Map params) {}
@Override
public void onAdLoadSucceeded(final InMobiInterstitial ad) {
Log.d(TAG, "onAdLoadSucceeded: ");
}
@Override
public void onAdDisplayFailed(InMobiInterstitial inMobiInterstitial) {
Log.d(TAG, "onAdDisplayFailed: ");
}
@Override
public void onAdWillDisplay(InMobiInterstitial inMobiInterstitial) {
Log.d(TAG, "onAdWillDisplay: ");
}
@Override
public void onAdLoadFailed(InMobiInterstitial ad, InMobiAdRequestStatus requestStatus) {
Log.d(TAG, "onAdLoadFailed: " + requestStatus.getMessage());
}
@Override
public void onAdReceived(InMobiInterstitial inMobiInterstitial) {
Log.d(TAG, "onAdReceived: ");
}
@Override
public void onUserLeftApplication(InMobiInterstitial ad){
Log.d(TAG, "onUserLeftApplication: ");
}
});
interstitial.load();
if(interstitial.isReady())
interstitial.show();