Reputation: 333
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.
Upvotes: 1
Views: 1815
Reputation: 380
Add this way and to get device id check this post
.addTestDevice("DEVICE_ID_1")
.addTestDevice("DEVICE_ID_2")
.addTestDevice("DEVICE_ID_3")
Upvotes: 1
Reputation: 12478
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.
Upvotes: 2
Reputation: 10724
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.
Upvotes: 2