Search code examples
androidadmobnative-ads

AdLoader always loads content ad


I have created a custom AdLoader for my application. But it always loads content ads and never install ads. If I remove .forContentAd I will get install ads but if I leave both I will only get content ads. Can anyone tell me why?

Here is my code:

 new AdLoader.Builder(activityContext, getString(R.string.test_admob_unit_id))
                .forContentAd(new NativeContentAd.OnContentAdLoadedListener() {
                    @Override
                    public void onContentAdLoaded(NativeContentAd contentAd) {
                        adQueue.add(contentAd);
                    }
                })
                .forAppInstallAd(new NativeAppInstallAd.OnAppInstallAdLoadedListener() {
                    @Override
                    public void onAppInstallAdLoaded(NativeAppInstallAd appInstallAd) {
                        adQueue.add(appInstallAd);
                    }
                })

            .withAdListener(new AdListener() {
                @Override
                public void onAdFailedToLoad(int errorCode) {
                    // Handle the failure by logging, altering the UI, etc.
                }
            })
            .withNativeAdOptions(new NativeAdOptions.Builder()
                    // Methods in the NativeAdOptions.Builder class can be
                    // used here to specify individual options settings.
                    .build())
        .build();

Solution

  • Yes, I can tell you why.

    When you make a request, AdMob's servers will always try to pick the ad that's going to make you the most money. They do this by conducting an auction in which different advertisers' campaigns compete to be the one shown in your app. It's possible (especially in some parts of the world) for most of the high-paying ads to be concentrated in one format. This can make it so you see a hundred ads or more in a row of one type. It's entirely normal, and it's just a result of more advertisers in your area wanting to purchase one type of ad than another.

    I don't see any issues with your AdLoader code, and since you do see app install ads when you comment out forContentAd(), I don't believe you're doing anything wrong. There's just a bunch of content ads waiting to be shown in your neighborhood. :)