简体   繁体   中英

AdMob shows real ads even when using a test unit id; Android

TLDR: I get real ads even if I use a sample unit id provided by Google for testing.

I implemented native ads in my application. I am using the Native Advanced sample ad unit as described here:

https://developers.google.com/admob/android/test-ads

However, the ads I get look very real, even though they have a "Test Ad" text in the title, and they also redirect me to real company websites. This has not happened with banner ads, I only got Google sample ads previously (eg Nice job, this is a test ad).

在此处输入图像描述 在此处输入图像描述

Some of the ads are coming from well-known restaurants in my country, and clicking on them navigates me to their website. I don't use my own unit id anywhere.

This is the code I use to initialize ads.

  public static final String UNIFIED_AD_UNIT_ID = "ca-app-pub-3940256099942544/2247696110";

  MobileAds.initialize(context, initializationStatus -> {
        });

        AdLoader adLoader = new AdLoader.Builder(context, UNIFIED_AD_UNIT_ID)
                .forUnifiedNativeAd(unifiedNativeAd -> {
                    populateNativeAdView(unifiedNativeAd, nativeAdView);
                }).build();
        adLoader.loadAd(new AdRequest.Builder().build());
    }

Is this a bug, or am I doing something wrong? (Or are these really test ads?) I really don't want to get banned from AdMob.

If you start your App running Android Studio, you can get the test device id for your device from the logcat at the bottom of Android Studio. Add this to your builder. By the way, the ads you are getting are looking like they should.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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