I tried debugging with my MotoX phone via USB and just running the app on its own and could not get this to work with interstitial ads, even after contacting the support team. They told me my code looked correct, but don't worry. As long as I didn't click on the ads, it would be ok for testing. I wasn't taking any chances so I used the code below to check if the current device ID was mine. If it was, I changed the ad unit id to the test ad unit id. They didn't seem very interested in fixing this bug.
String android_id = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
String deviceId = md5(android_id).toUpperCase();
String unitId = MY_UNIT_ID;
if (deviceId.equals(MY_DEVICE_ID)) { // Use the AdMob Interstitial Test Unit ID
unitId = context.getResources().getString("ca-app-pub-3940256099942544/1033173712");
}
admobAd.setAdUnitId(unitId);
// Here's the md5 method
private String md5(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++)
hexString.append(Integer.toHexString(0xFF & messageDigest[i]));
return hexString.toString();
} catch (Exception e) {
e.printStackTrace();
}
return "";
}