Test Ads in the Android Admob Unity Plugin

If you have an application all set up with the Android Admob Unity Plugin and you want some test ads so you can test clicking and such without upsetting Admob, here is how to do this.

First you will need your ‘Test Device ID’. The only way I know of to get this is to check the logcat in Eclipse while you device is plugged in (and running your game with Ads showing), search for a line that looks like:

To get test ads on this device, call adRequest.addTestDevice(“Your Test Device ID”);

After you have the device id, add the following method to the AdMobUnityPlugin class:

public static void SetTestMode(string test_device_id){
  AndroidJavaClass jc = new AndroidJavaClass(classname);

Then this should be called before you call StartAds(), i.e.

void Start(){
  AdMobUnityPlugin.SetTestMode("My Test Device ID in here");

That’s it, you should now get test ads. Obviously please remember to remove the call to the SetTestMode method before you deploy for real, however if you forget you can disable test mode in your application settings on the Admob website (just below where you can set the refresh rate).

One thought on “Test Ads in the Android Admob Unity Plugin

Leave a Reply

Your email address will not be published. Required fields are marked *