2

MainActivity can launch Activities A,B and C and in those last three I want to show 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.

Is there a way to request from AppoDeal allready cached NativeAds inside Activities A,B andC? Or else pass the List object from MainActivity to the other three?

Anonymous
  • 4,470
  • 3
  • 36
  • 67

1 Answers1

0

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.

DroidHeaven
  • 2,414
  • 3
  • 25
  • 31
  • Btw, I've some queries related to Appodeal. Did you manage to get multiple ads on native ad callback - public void onNativeLoaded(List nativeAds)? My list contained only a single item. – DroidHeaven May 21 '17 at 19:41