admob test ads appearing

倖福魔咒の 提交于 2020-01-01 17:05:13

问题


I released my Android app two days ago, using admob advertising. I used my personal phone as the test phone, but took out the test mode code before releasing it. My admob status is active and I get requests and impressions on the report, but whenever I try to use the app on my personal phone i only get "test ads". I don't know why. I looked through the code of my app and can't find anything amiss. And i did delete the test version of the app and then download the released version from the market.


回答1:


I'm not sure why the test ads are appearing in your app, but one way to shut them off is to go to your Admob App Settings, and choose the option "Disable test mode for all requests" as your Test Mode setting.




回答2:


You customers would not have been seeing the debug ads. You probably have a line like:

AdManager.setTestDevices( new String[] { 
  AdManager.TEST_EMULATOR, // Android emulator 
  "E83D20734F72FB3108F104ABC0FFC738", // My T-Mobile G1 Test Phone 
}

Assuming E83D20734F72FB3108F104ABC0FFC738 is you're personal phone, any time that phone makes a request it will get a test ad. All other phones will not be eligible for test ads, unless they are also individually added to that method.




回答3:


Nick's answer works. (But is missing the final parenthesis.)

But what if I want to give my (not yet released) Android app out to 10 friends?

Is there any java code that says "treat ALL phones as test devices"?




回答4:


Here is code for treat all devices as test devices:

        String aid = Settings.Secure.getString(context.getContentResolver(), "android_id");
        try {
            Object obj;
            ((MessageDigest) (obj = MessageDigest.getInstance("MD5"))).update(aid.getBytes(), 0, aid.length());

            aid = String.format("%032X", new Object[] { new BigInteger(1, ((MessageDigest) obj).digest()) });
        } catch (NoSuchAlgorithmException localNoSuchAlgorithmException) {
            aid = aid.substring(0, 32);
        }

        adRequest.addTestDevice(aid);


来源:https://stackoverflow.com/questions/4829567/admob-test-ads-appearing

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!