Admob Video Interstitial Test/dummy Id
Is there a test id for admob interstitial video ad ? i know dummy test id for banner and image interstitial Banner : ca-app-pub-3940256099942544/6300978111 Interstitial:ca-app-p
Solution 1:
As answered here : How can I get device ID for Admob
you can make the current running device into an adview test device programmatically
if(YourApplication.debugEnabled(this)) //debug flag from somewhere that you set
{
Stringandroid_id= Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID);
StringdeviceId= md5(android_id).toUpperCase();
mAdRequest.addTestDevice(deviceId);
booleanisTestDevice= mAdRequest.isTestDevice(this);
Log.v(TAG, "is Admob Test Device ? "+deviceId+" "+isTestDevice); //to confirm it worked
}
You need to use the md5 of the Android ID, and it needs to be upper case. Here is the md5 code I used
publicstaticfinal String md5(final String s) {
try {
// Create MD5 HashMessageDigestdigest= java.security.MessageDigest
.getInstance("MD5");
digest.update(s.getBytes());
byte messageDigest[] = digest.digest();
// Create Hex StringStringBufferhexString=newStringBuffer();
for (inti=0; i < messageDigest.length; i++) {
Stringh= Integer.toHexString(0xFF & messageDigest[i]);
while (h.length() < 2)
h = "0" + h;
hexString.append(h);
}
return hexString.toString();
} catch (NoSuchAlgorithmException e) {
Logger.logStackTrace(TAG,e);
}
return"";
}
Post a Comment for "Admob Video Interstitial Test/dummy Id"