0

私は常にadmobsのテスト追加を取得しています。setTestDevicesのデバイスIDを設定していても、実際の追加は表示されません。また、addTestDevicesも試してみました。よろしくお願いします。これが私のコードです。

    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;
    }
4

1 に答える 1

0

実際の広告を取得するには、adRequest.setTestDevices(hsDevice); を削除します。あなたのコードから。

誤ってクリックしないように、プレースホルダー広告を取得するためだけの開発目的です。https://developers.google.com/mobile-ads-sdk/docs/admob/best-practicesをご覧ください

于 2013-03-11T20:10:31.470 に答える