Admob AdRequest.isTestDevice return false when add test device in admob

46 views
Skip to first unread message

哈哈不想哈哈

unread,
Sep 29, 2024, 8:27:58 PM9/29/24
to Google Mobile Ads SDK Developers
hi,
I have a question about the TestDevice:
After I set TestDevice with code it is correct to get device status with api of AdRequest.isTestDevice.
But after I added the test device in the admob ui, I got false using AdRequest.isTestDevice.

Is the AdRequest.isTestDevice api availability only for code?

thanks

Mobile Ads SDK Forum Advisor

unread,
Sep 30, 2024, 8:19:58 AM9/30/24
to hubin...@gmail.com, google-adm...@googlegroups.com

Hi,

Thank you for contacting the Mobile Ads SDK Support team.

Yes, the AdRequest.isTestDevice API availability only for code. AdRequest.isTestDevice() describes the request only. It is true if you set up test devices programatically. If you add the test device in the AdMob UI then AdRequest.isTestDevice = false is expected because SDK may not know that the device is a test request at the time that API is called. When that API was first designed, the UI didn't have a way to enable test devices and it was only checking the SDK-enabled version. 

I hope this helps! Let me know if you have any other questions.

This message is in relation to case "ref:!00D1U01174p.!5004Q02vGbDO:ref" (ADR-00269993)

Thanks,
 
Google Logo Mobile Ads SDK Team


哈哈不想哈哈

unread,
Oct 7, 2024, 5:53:52 AM10/7/24
to Google Mobile Ads SDK Developers
hi,
As you said, if AdRequest.isTestDevice is only effective when set using code, then what API can be used when setting TestDevice in the admob ui?

thanks

Mobile Ads SDK Forum Advisor

unread,
Oct 7, 2024, 6:05:18 PM10/7/24
to hubin...@gmail.com, google-adm...@googlegroups.com
Hi,

Right now, there's no way to use an API to check if a device is a test device. The only way to know for sure is if the ads served by AdMob have a label that tells you you're in test mode.

Please note that mediated ads do NOT render a Test Ad label. You are responsible for ensuring that test ads are enabled for each of your mediation networks so these networks don't flag your account for invalid activity. See each network's respective mediation guide for more information.
Reply all
Reply to author
Forward
0 new messages