0
我總是得到admobs的測試添加。我沒有看到任何真正增添了我設置爲setTestDevices設備ID,也是我試過addTestDevices也 請幫我 在此先感謝 這裏是我的代碼..真實添加Admobs在Android
HashSet<String> hsDevice = new HashSet<String>();
hsDevice.add(getDeviceIDforAdMob());
adRequest.setTestDevices(hsDevice);
DfpAdView adView = new DfpAdView(Base.this, AdSize.BANNER, baneerID);
adView.loadAd(adRequest);
public String getDeviceIDforAdMob()
{
String aid = Settings.Secure.getString(Base.this.getContentResolver(), "android_id");
Object obj = null;
try
{
((MessageDigest) (obj = MessageDigest.getInstance("MD5"))).update(aid.getBytes(), 0, aid.length());
obj = String.format("%032X", new Object[] { new BigInteger(1,((MessageDigest) obj).digest()) });
}
catch (NoSuchAlgorithmException localNoSuchAlgorithmException)
{
obj = aid.substring(0, 32);
}
return (String) obj;
}