Android interstitial ads add test device?

You can easily add test devices using banner ads so that you are not banned by accidentally clicking on them. However, I cannot find how to add test devices to interstitial ads. I assume that you can also be blocked if you accidentally click on them.

Can you add test devices to them, and if so, how? I can not find it in the official guide of Google, as well as in SA. How to get a test ad Banners and testing of interstitial ads working in adMob? , looked promising, but there was no answer to the question of how to add test devices.

+4
source share
3 answers

Can you add test devices to them, and if so, how?

So here you are:

// request test interstitial ads
        AdRequest adRequestInterstitial = new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .addTestDevice(testDeviceId)
            .build();

// request test banner ads
  AdRequest adRequestBanner = new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .addTestDevice(testDeviceId)
            .build();
+10
source

I am using admob ad id:

  • For banner: ca-app-pub-3940256099942544/6300978111
  • For interstitial: ca-app-pub-3940256099942544/1033173712

Contact: link

0
source

.....! , test_device. .

add:

SharedPreferences var1 = context.getSharedPreferences("FBAdPrefs", 0);
        String i = u.b(UUID.randomUUID().toString());
        if (!var1.getString("deviceIdHash", "").equals(i))
        {
            var1.edit().putString("deviceIdHash", i).apply();
        }

        AdSettings.addTestDevice(i);

facebook ad..!

0

Source: https://habr.com/ru/post/1526050/


All Articles