对Android的原生广告网络做出反应

时间:2018-07-22 14:17:31

标签: android react-native

我正在寻找一个广告网络来响应本机排除admob和fb广告。 我尝试整合Startapp广告,但始终失败。 在MainActivity.java

protected void onCreate(Bundle savedInstanceState) {
    StartAppSDK.init(this, "APP_ID", false);
    StartAppAd.disableSplash();
    super.onCreate(savedInstanceState);
    Log.d(TAG,"onCreate 2");  
}

在CusLayout.java

public class CusLayout extends ReactViewGroup {
private Context context;
private Banner startAppBanner = null;
private String TAG = "CusLayout";

public CusLayout(Context context) {
    super(context);
    this.context = context;
    Log.d(TAG,"CusLayout");
    startAppBanner = new Banner(context);
    RelativeLayout.LayoutParams bannerParameters =
            new RelativeLayout.LayoutParams(
                    RelativeLayout.LayoutParams.WRAP_CONTENT,
                    RelativeLayout.LayoutParams.WRAP_CONTENT);
    bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL);
    bannerParameters.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    Log.d(TAG,"init");
    startAppBanner.setBannerListener(new BannerListener() {
        @Override
        public void onReceiveAd(View view) {
            Log.d(TAG,"onReceiveAd ");
        }

        @Override
        public void onFailedToReceiveAd(View view) {
            Log.d(TAG,"onFailedToReceiveAd " + view.toString());
            startAppBanner.showBanner();
        }

        @Override
        public void onClick(View view) {
            Log.d(TAG,"onClick");
        }
    });
    this.addView(this.startAppBanner, bannerParameters);
}
}

Logcat总是说:“ onFailedToReceiveAd”

有人可以帮助我解决这个问题吗?还是您向我推荐了一个新的广告网络(不是admob或facebook广告)?

0 个答案:

没有答案