Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The accepted answers will work if you are only testing on the Emulator or on a few devices, but if you are testing on a plethora of devices, you may need some means of prorammatically adding the running device's device ID.</p> <p>The following code will make the current running device into an adview test device programmatically</p> <pre><code>... if(YourApplication.debugEnabled(this)) //debug flag from somewhere that you set { String android_id = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID); String deviceId = md5(android_id).toUpperCase(); mAdRequest.addTestDevice(deviceId); boolean isTestDevice = mAdRequest.isTestDevice(this); Log.v(TAG, "is Admob Test Device ? "+deviceId+" "+isTestDevice); //to confirm it worked } </code></pre> <p>You need to use the md5 of the Android ID, and it needs to be upper case. Here is the md5 code I used</p> <pre><code>public static final String md5(final String s) { try { // Create MD5 Hash MessageDigest digest = java.security.MessageDigest .getInstance("MD5"); digest.update(s.getBytes()); byte messageDigest[] = digest.digest(); // Create Hex String StringBuffer hexString = new StringBuffer(); for (int i = 0; i &lt; messageDigest.length; i++) { String h = Integer.toHexString(0xFF &amp; messageDigest[i]); while (h.length() &lt; 2) h = "0" + h; hexString.append(h); } return hexString.toString(); } catch (NoSuchAlgorithmException e) { Logger.logStackTrace(TAG,e); } return ""; } </code></pre> <p>EDIT: Apparently that MD5 method isnt perfect, and it was suggested to try <a href="https://stackoverflow.com/a/21333739/2662474">https://stackoverflow.com/a/21333739/2662474</a> I no longer need this feature so I havent tested. Good luck!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload