For those facing future problems.
The information presented here does not exclude what has already been said by others, they are just complements, some more things to be taken into account.
As of Jan 2022, the app setup process has changed in admob. A notification was sent to the console with the following message:
All new apps added to AdMob need to be reviewed and
approved. Make sure your AdMob apps are linked
to a supported app store to prevent ad serving
be interrupted. Linking generates an automatic review of the apps.
1-
As you know, there are two ways to configure an application in admob: Published and Unpublished.
If the app has already been published, and the SDK is implemented correctly, there will be no runtime errors, as long as the adsense policies and google platform
If you haven't published your app yet but want to run and test ads, you need to adhere to best practices.
Add your advertising ID/IDFA from your physical device used for testing on admob > settings > test-devices > create might be a good one.
This will allow you to keep your device as a test, even after publishing in the store.
2-
Do not use AdRequest.Builder.addTestDevice()
in your code when you are debugging. It has been discontinued.
For debugging purposes, use RequestConfiguration.Builder.setTestDeviceIds()
instead. You will have something like this:
public static final String TEST_J7 = "F1FDCA11111AF1111111FF11C1111111";
public static final String TEST_GRAN_PRIME = "F1FDCA11111AF1111111FF11C1111111";
public static final String TEST_XIAOMI = "F1FDCA11111AF1111111FF11C1111111";
public static final String TEST_EMULATOR = AdRequest.DEVICE_ID_EMULATOR;
// if you don't know the id, look it up in Logcat in a normal request
public void newConfiguration() {
String[] tests = {TEST_EMULATOR, TEST_J7, TEST_GRAN_PRIME, TEST_XIAOMI};
MobileAds.setRequestConfiguration(new RequestConfiguration.Builder()
.setTestDeviceIds(Arrays.asList(tests)).build());
}
3-
Always use test ads to prevent delivery from being suspended:
public static final String TEST_UNIT_BANNER = "ca-app-pub-3940256099942544/6300978111";
public static final String TEST_UNIT_REWARD = "ca-app-pub-3940256099942544/5224354917";
public static final String TEST_UNIT_NATIVE = "ca-app-pub-3940256099942544/2247696110";
public static final String TEST_UNIT_INTERSTITIAL = "ca-app-pub-3940256099942544/1033173712";
public void loadAd(boolean is_test_device, String unit) {
if (is_test_device) {
newConfiguration();
}
AdRequest request = new AdRequest.Builder().build();
AdView banner = new AdView(c);
banner.setAdUnitId(is_test_device ? TEST_UNIT_BANNER : unit);
banner.loadAd(request);
//...
InterstitialAd.load(c, is_test_device ? TEST_UNIT_INTERSTITIAL : unit, request, /*callback*/);
//...
RewardedInterstitialAd.load(c, is_test_device ? TEST_UNIT_REWARD : unit, request, /*callback*/);
//...
}
According to the documentation:
Your app will receive limited ad serving until it is approved during the AdMob preparation process. In order for your app to be reviewed and approved by AdMob, you will need to list it on an AdMob-compatible store and link your app to the app store in your AdMob account.
The suspension of ads can last for up to 30 days, or be permanent in case of violation of adsense policies.
4-
After setting up your test device, reset your Advertising ID by going to Settings > Google > Ads > Reset Advertising ID on your physical device.
Don't forget to use your own unit_id in your distribution app.
Learn more here: About app readiness Set up a test device