开发者

AdMob Android Integration

开发者 https://www.devze.com 2023-02-02 03:47 出处:网络
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});

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? Wo开发者_开发百科n'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?


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 :).
0

精彩评论

暂无评论...
验证码 换一张
取 消