May 9, 2010

[SOLVED] Android: Set Admob programmatically into test mode


(6) When integrating AdMob ads into your application it is recommended to use test mode. In test mode test, ads are always returned.


Test mode is enabled on a per-device basis. To enable test mode for a device, first request an ad, then look in LogCat for a line like the following:



  To get test ads on the emulator use AdManager.setTestDevices...

Once you have the device ID you can enable test mode by calling AdManager.setTestDevices:



  AdManager.setTestDevices( new String[] {                 
AdManager.TEST_EMULATOR, // Android emulator
"E83D20734F72FB3108F104ABC0FFC738", // My T-Mobile G1 Test Phone
} );



Source: Android - Admob For Developers.

5 comments:

  1. how can i get the device id

    ReplyDelete
  2. Watch the log with "adb logcat". The AdMobSDK outputs it for you.

    ReplyDelete
  3. what version of the admob sdk? The latest, 4.0.4 doesn't require this, just use request.setTesting(true);

    ReplyDelete
  4. How can I get the device ID in java code?

    ReplyDelete
  5. you can get device id by dialing *#*#8255#*#*

    ReplyDelete