user485498
user485498

Reputation:

admob test ads appearing

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.

Upvotes: 2

Views: 2336

Answers (4)

anTONIos
anTONIos

Reputation: 21

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);

Upvotes: 1

Carol
Carol

Reputation: 105

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"?

Upvotes: 2

Nick Campion
Nick Campion

Reputation: 10479

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.

Upvotes: 5

Abhinav Manchanda
Abhinav Manchanda

Reputation: 6631

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.

Upvotes: 5

Related Questions