InMobi广告没有在Android上展示? [英] InMobi ads does not show up on Android?

查看:137
本文介绍了InMobi广告没有在Android上展示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实施InMobi广告,但广告没有显示。

I am trying to implement InMobi ads, but ads do not show up.

我在此处遵循了该教程: http://www.inmobi.com/support/integration/23817448/22051163/android-sdk- Integration-guide /

I have followed the tutorial here : http://www.inmobi.com/support/integration/23817448/22051163/android-sdk-integration-guide/

这是我的代码;

interstitial = new IMInterstitial(this, "my_property_id");

    interstitial.loadInterstitial();

    if (interstitial.getState() ==IMInterstitial.State.READY)
        interstitial.show();

    interstitial.setIMInterstitialListener(new IMInterstitialListener() {
        public void onShowInterstitialScreen(IMInterstitial arg0) {
        }
        @Override
        public void onLeaveApplication(IMInterstitial arg0) {
        }
        @Override
        public void onDismissInterstitialScreen(IMInterstitial arg0) {
        }
        @Override
        public void onInterstitialLoaded(IMInterstitial arg0) {
        }
        @Override
        public void onInterstitialInteraction(IMInterstitial interstitial, Map<String, String> params) {                
        }
        @Override
        public void onInterstitialFailed(IMInterstitial arg0, IMErrorCode arg1) {
        }
    }); 

我想念什么?

推荐答案

尽管这是一个很晚的答复,但希望对您有所帮助。首先是定义必要的权限和活动以体现。对于引荐来源跟踪,您必须添加:

Although, this is a pretty late reply, I hope it helps you. First thing is to define necessary permissions and activities to manifest. For referrer tracking, you must add:

<receiver
        android:name="com.inmobi.commons.analytics.androidsdk.IMAdTrackerReceiver"
        android:enabled="true"
        android:exported="true" >
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
</receiver>

还必须在清单中添加InMobi活动:

You must also add InMobi activity to your manifest:

<activity
        android:name="com.inmobi.androidsdk.IMBrowserActivity"
       android:configChanges="keyboardHidden|orientation|keyboard|smallestScreenSize|screenSize"
        android:hardwareAccelerated="true" />

在Java部分中,首先必须初始化InMobi。通常在启动器活动中完成此操作。如果您尚未初始化,则这是代码中缺少的第一件事。第二件事是缺少听众。插页式广告的类应该是这样的:

In the java part, first you have to initialize InMobi. This is generally done in launcher activity. If you haven't initialized, this was the first thing missing in your code. The second thing was the missing listener. The class for interstitial ad should be sth like this:

public class InterstitialAdActivity extends Activity implements IMInterstitialListener     {

protected IMInterstitial mIMInterstitialAd;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    InMobi.initialize(this, "ID");
    mIMInterstitialAd = new IMInterstitial(this, "ID");
    mIMInterstitialAd.setIMInterstitialListener(this);
    mIMInterstitialAd.loadInterstitial();
}

@Override
public void onDismissInterstitialScreen(IMInterstitial arg0) {
    // TODO Auto-generated method stub

}

@Override
public void onInterstitialFailed(IMInterstitial arg0, IMErrorCode arg1) {
    // TODO Auto-generated method stub

}

@Override
public void onInterstitialInteraction(IMInterstitial arg0,
        Map<String, String> arg1) {
    // TODO Auto-generated method stub

}

@Override
public void onInterstitialLoaded(IMInterstitial arg0) {
    if(mIMInterstitialAd.getState() == State.READY)
        mIMInterstitialAd.show();
}

@Override
public void onLeaveApplication(IMInterstitial arg0) {
    // TODO Auto-generated method stub

}

@Override
public void onShowInterstitialScreen(IMInterstitial arg0) {
    // TODO Auto-generated method stub

}

}

这篇关于InMobi广告没有在Android上展示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆