Reputation: 23394
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-pub-3940256099942544/1033173712
i need dummy test id for video interstitial
i already know how to add test device id
AdView adView = (AdView)this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("TEST_DEVICE_ID")
.build();
adView.loadAd(adRequest);
but i want to give demo to some other guy whose device id is unknown
so can some one give me the
thanks in advance
Upvotes: 1
Views: 2145
Reputation: 404
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
{
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
}
You need to use the md5 of the Android ID, and it needs to be upper case. Here is the md5 code I used
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 < messageDigest.length; i++) {
String h = 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 "";
}
Upvotes: 1