0

i just learn native ad with simple code and try to test run appodeal native ad. but theres no test-ad showd.

    Appodeal.setAutoCache(Appodeal.NATIVE, false);
    Appodeal.initialize(this, "apikey", Appodeal.NATIVE);
    Appodeal.cache(this, Appodeal.NATIVE);
    Appodeal.setNativeCallbacks(new NativeCallbacks() {
        @Override
        public void onNativeLoaded() {
            Toast.makeText(MainActivity.this, "onNativeLoaded", Toast.LENGTH_SHORT).show();
         }

        @Override
        public void onNativeFailedToLoad() {
            Toast.makeText(MainActivity.this, "onNativeFailedToLoad", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onNativeShown(NativeAd nativeAd) {
            Toast.makeText(MainActivity.this, "onNativeShown", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onNativeClicked(NativeAd nativeAd) {
            Toast.makeText(MainActivity.this, "onNativeClicked", Toast.LENGTH_SHORT).show();
        }
    });
    Appodeal.getNativeAds(1);
    com.appodeal.ads.native_ad.views.NativeAdViewContentStream nav_cs = this.findViewById(R.id.native_ad_view_content_stream);
    nav_cs.setNativeAd(nativeAd);

what is wrong? whats my mistake?

MB Relawan
  • 21
  • 10

2 Answers2

1

To enable test ads in Appodeal add this line to your code: Appodeal.setTesting(true);

This will enable test ads not only for the native Appodeal ads, but for all the ad types: banners, interstitials, etc.

Adomas
  • 466
  • 1
  • 8
  • 21
0

Looks like you need more time to load ads. Usually it takes about 20 - 60 second.

In his case, you can try to use the following code: https://pastebin.com/Wbe0V6fm

Also, check our demo project: https://github.com/appodeal/appodeal-android-demo Class: https://github.com/appodeal/appodeal-android-demo/blob/master/app/src/main/java/com/appodeal/test/AppodealWrapperAdapter.java

Yvonne
  • 61
  • 1