You can easily add test devices with banner ads so you don\'t get banned by accidentally clicking on them. However I cannot find how to add test devices to interstitial ads.
Can you add test devices to these and if so, how?
So here you go:
// 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();
I use the admob test ads id:
Refer: link
A small hack & its done.....! I have write few lines of code ,which will add every device as a test_device ,When you run your app in it .
Just Write this code before loading the 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);
It works for all type of facebook ad's ..!