When using AdMob in our projects, be it a Unity game or an app, we better test our ads on a real device besides emulators. But to comply with the AdMob policy, we need to add the tester device's Id as a test device in our AdMob code. But how to find our device's Id?
iOS
When we create an ad request in code, we can add test devices too.
For Objective-C:
GADRequest *request = [GADRequest request]; request.testDevices = @[@"3423aa7873bec7837928"];
And for Swift:
let request = GADRequest() request.testDevices = ["3423aa7873bec7837928"]
Just run your app or your game from XCode with those arbitrary values and look at the Logs window. You'll see something like that:
<Google> To get test ads on this device, call: request.testDevices = @[@"xxxx" ];
So, what is written instead of "xxxx" is your device's Id. Just copy this Id and paste it to your code.
Android
The simplest way to find the device id for Android is to use Android Studio. Just open the Android Studio and run your app and look at the LogCat window. Type "Ads" to the filter of this LogCat window and search for :