1

I am using admob to display ads in my android app. I can add single Test Device using addTestDevice("DEVICE_ID") But how to add multiple devices as Test Devices?

I tried addTestDevice("DEVICE_ID_1, DEVICE_ID_2, DEVICE_ID_3") but its not working.

AnujDeo
  • 333
  • 1
  • 4
  • 13
  • you can do it from xml as below ads:testDevices="TEST_EMULATOR, TESTDEVICE1_ID,TESTDEVICE2_ID" – karan Sep 10 '15 at 06:20
  • @KaranMer : Its not working. It gives error - No resource identifier found for "testDevices" – AnujDeo Sep 10 '15 at 06:29

3 Answers3

2

Call addTestDevice for each device_id.

Builder adRequestBuilder = new AdRequest.Builder();
adRequestBuilder.addTestDevice(DEVICE_ID_1);
adRequestBuilder.addTestDevice(DEVICE_ID_2);
adRequestBuilder.addTestDevice(DEVICE_ID_3);
...
AdRequest adRequest = adRequestBuilder.build();

You can call this method multiple times before build it.

hata
  • 11,633
  • 6
  • 46
  • 69
2

From the google api docs:

AdRequest request = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)        // All emulators
.addTestDevice("AC98C820A50B4AD8A2106EDE96FB87D4")  // My Galaxy Nexus test phone
.build();

So you can add an unlimited number of devices in the same request by just calling addTestDevice again.

Or you can do it in the xml like the comment of karan mer suggested.

Niki van Stein
  • 10,564
  • 3
  • 29
  • 62
1

Add this way and to get device id check this post

.addTestDevice("DEVICE_ID_1")
.addTestDevice("DEVICE_ID_2")
.addTestDevice("DEVICE_ID_3")
Community
  • 1
  • 1
Jaykumar Donga
  • 380
  • 1
  • 3
  • 18