简体   繁体   English

Android-AppoDeal-多项活动中的NativeAds

[英]Android - AppoDeal - NativeAds in multiple activities

MainActivity can launch Activities A,B and C and in those last three I want to show NativeAds. MainActivity可以启动活动A,B和C,最后三个我要显示NativeAds。 I find it an overkill to do this in every activity. 我发现在每次活动中都这样做是过大的。

    Appodeal.setNativeCallbacks(new NativeCallbacks() {
        @Override
        public void onNativeLoaded(List<NativeAd> list) { /* show ads*/}

        @Override
        public void onNativeFailedToLoad() {   }

        @Override
        public void onNativeShown(NativeAd nativeAd) {  }

        @Override
        public void onNativeClicked(NativeAd nativeAd) {   }
    });

    if(numberOfAds==1) {
        Appodeal.cache(this, Appodeal.NATIVE);
    }
    else{
        Appodeal.cache(this, Appodeal.NATIVE, numberOfAds);
    }

Plus it takes quite some time for NativeAds to load and I would prefer to show the ads immediately on create. 另外,NativeAd的加载需要相当长的时间,我希望在制作时立即展示广告。

Is there a way to request from AppoDeal allready cached NativeAds inside Activities A,B andC? 是否可以从AppoDeal请求活动A,B和C中所有已缓存的NativeAd? Or else pass the List object from MainActivity to the other three? 否则将List对象从MainActivity传递给其他三个对象?

Sorry for being late but my two cents. 对不起,迟到了,但我要两分钱。 You can define a interface (having methods which will be called from Native Ads' callbacks) in the main activity and then make A, B and C implement it. 您可以在主要活动中定义一个接口(具有将从Native Ads的回调中调用的方法),然后让A,B和C实现该接口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM