AngryHacker
AngryHacker

Reputation: 61646

AdMob Android Integration

Issue #1: In the tutorials, that I've looked at, a lot of folks place this line of code:

AdManager.setTestDevices( new String[] {AdManager.TEST_EMULATOR});

into the onCreate override of the activity. And sure enough, the test ad shows up.

Am I supposed to leave this line when I actually submit my app to the App Store? Won't it show a test ad when the users actually use my app?

Issue #2: I've also seen some examples where the code manually requests the ad:

AdView adView = (AdView) findViewById(R.id.ad);
adView.requestFreshAd();

Do I actually need these lines?

Unfortunately I don't have a device handy and can't test any of these assumptions?

Upvotes: 0

Views: 638

Answers (1)

Cristian
Cristian

Reputation: 200160

Am I supposed to leave this line when I actually submit my app to the App Store? Won't it show a test ad when the users actually use my app?

You may want to delete that before submitting the app to the Market. It will not affect (that line affects emulators only, so the users will see real ads), but you won't need it either (refer to YAGNI principle).

Issue #2: I've also seen some examples where the code manually requests the ad:

You may need it for some special cases. For instance, if you are going to show your ad in a single activity, you won't need it. A couple of cases when it's useful:

  • Your ad is at the top of a TabHost and you want to change the ad when the user changes the current tab.
  • Your single activity will be used by your users for a long time (for example, a PDF reader). Then, you may want to change the ad each, say, 15 mins (calling requestFreshAd of course :).

Upvotes: 1

Related Questions