0Pricing
Indie Hacker Mobile Apps · 课时

移动广告集成

学习如何加入各种广告形式(横幅广告、插屏广告、激励视频),并管理广告网络以创造收入。

移动广告集成 是 CoddyKit 上的免费 Indie Hacker Mobile Apps 课时。 这是第 2 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 Indie Hacker Mobile Apps 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 Indie Hacker Mobile Apps 课程共包含 4 节课。

本课时的部分内容尚未翻译,以英文显示。

Monetize Your App with Ads

Welcome to integrating mobile advertising! For many indie hackers, ads are a key way to generate revenue from their apps, especially for free-to-download titles.

This lesson will introduce you to different ad formats and how they can be integrated into your mobile application to create a sustainable income stream.

Understanding Ad Networks

To show ads, you'll work with an Ad Network. These platforms connect app publishers (you!) with advertisers. Popular choices include Google AdMob, Facebook Audience Network, and Unity Ads.

  • SDK: You integrate the network's Software Development Kit into your app.
  • eCPM: Effective Cost Per Mille (thousand impressions), a key metric for how much you earn.
  • Fill Rate: How often the ad network successfully provides an ad for your request.

Banner Ads: Always Visible

Banner ads are small rectangular ads that usually appear at the top or bottom of your app screen. They are the least intrusive ad format, providing a steady but generally lower revenue stream.

  • Pros: Constant presence, minimal disruption.
  • Cons: Lower eCPM, users can develop 'banner blindness'.

Integrating Banner Ads

Integrating a banner ad typically involves initializing the ad network's SDK, creating an ad view, and adding it to your app's layout. The SDK handles loading and displaying the ad.

Here's a conceptual look:

// 1. Initialize Ad SDK
AdSDK.initialize(context, "YOUR_APP_ID");

// 2. Create a Banner Ad View
BannerAdView bannerView = new BannerAdView(context);
bannerView.setAdUnitId("YOUR_BANNER_AD_UNIT_ID");
bannerView.setAdSize(AdSize.BANNER);

// 3. Add to your app's layout (e.g., at the bottom)
LinearLayout layout = findViewById(R.id.ad_container);
layout.addView(bannerView);

// 4. Load the ad
AdRequest adRequest = new AdRequest.Builder().build();
bannerView.loadAd(adRequest);

Interstitial Ads: Full Screen Breaks

Interstitial ads are full-screen ads that cover the entire interface of your app. They appear at natural transition points, like after completing a level in a game or between content sections.

  • Pros: Higher eCPM than banners, high visibility.
  • Cons: Can be disruptive if poorly placed, requires careful timing.

Integrating Interstitial Ads

Interstitial ads are loaded in the background and then shown at a specific moment. You need to handle callbacks for when the ad is loaded, shown, and dismissed by the user.

Conceptual integration:

// 1. Initialize Ad SDK (if not already)

// 2. Load the Interstitial Ad
InterstitialAd interstitialAd = new InterstitialAd(context, "YOUR_INTERSTITIAL_AD_UNIT_ID");
interstitialAd.loadAd(new AdRequest.Builder().build());

// 3. Define ad event callbacks (e.g., ad loaded, ad dismissed)
interstitialAd.setAdListener(new InterstitialAdListener() {
    @Override
    public void onAdLoaded() { /* Ad is ready to show */ }
    @Override
    public void onAdDismissed() { /* User closed ad, resume app */ }
    // ... other methods
});

// 4. Show the ad at a natural break point
if (interstitialAd.isLoaded()) {
    interstitialAd.show();
} else {
    // Ad not ready, continue app flow
}

Rewarded Video Ads: Opt-In Value

Rewarded video ads are full-screen video ads that users choose to watch in exchange for an in-app reward (e.g., extra lives, virtual currency, premium features). These are highly effective for engagement and revenue.

  • Pros: Highest eCPM, user-friendly (opt-in), drives engagement.
  • Cons: Requires careful reward balancing, users expect value.

Integrating Rewarded Video Ads

Rewarded videos require presenting an option to the user, then showing the ad and delivering the reward upon completion. Callbacks are crucial for handling the reward logic.

Conceptual integration:

// 1. Initialize Ad SDK (if not already)

// 2. Load the Rewarded Ad
RewardedAd rewardedAd = new RewardedAd(context, "YOUR_REWARDED_AD_UNIT_ID");
rewardedAd.loadAd(new AdRequest.Builder().build());

// 3. Present option to user (e.g., "Watch ad for 100 coins")
// On user confirmation:

// 4. Define ad event callbacks (e.g., ad completed, user rewarded)
rewardedAd.setAdListener(new RewardedAdListener() {
    @Override
    public void onRewarded(RewardItem rewardItem) {
        // User earned reward, grant 100 coins
        grantRewardToUser(rewardItem.getAmount());
    }
    @Override
    public void onAdClosed() { /* User closed ad */ }
    // ... other methods
});

// 5. Show the ad if loaded
if (rewardedAd.isLoaded()) {
    rewardedAd.show();
} else {
    // Ad not ready, inform user
}

Ad Placement Best Practices

Effective ad integration balances revenue with user experience. Poorly placed ads can annoy users and lead to uninstalls. Here are some tips:

  • Natural Breaks: Show interstitial ads during logical pauses.
  • Opt-In for Rewarded: Always let users choose to watch rewarded videos.
  • Frequency Capping: Don't bombard users with too many ads in a short period.
  • Test & Iterate: Monitor user feedback and analytics to optimize placement.

Ad Format Quiz

Which of the following statements about mobile ad formats are TRUE?

Recap & Next Steps

You've learned about the three main types of mobile ad formats: banner, interstitial, and rewarded video. We explored how ad networks work and conceptual steps for integrating each ad type.

Remember to prioritize user experience through smart placement and frequency capping. In your next steps, choose an ad network, integrate its SDK, and experiment with different ad placements to find what works best for your app!

常见问题解答

「移动广告集成」课时是免费的吗?

是的 — 「移动广告集成」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 Indie Hacker Mobile Apps 课程的其余内容,请升级到 CoddyKit PRO。 Indie Hacker Mobile Apps 课程共包含 4 节课。

「移动广告集成」这节课中我会学到什么?

学习如何加入各种广告形式(横幅广告、插屏广告、激励视频),并管理广告网络以创造收入。 你通过在浏览器中直接运行的动手代码来练习 Indie Hacker Mobile Apps,全天候 AI 导师会在你学习这节课的过程中回答你的问题。

学习 Indie Hacker Mobile Apps 需要有经验吗?

无需任何先前经验。CoddyKit 上的 Indie Hacker Mobile Apps 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 2 节课,共 4 节。

「移动广告集成」课时需要多长时间?

大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。

我能在这节 Indie Hacker Mobile Apps 课中编写并运行代码吗?

能。每节 Indie Hacker Mobile Apps 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。

此课程中的所有课时

  1. 应用内购买与订阅
  2. 移动广告集成
  3. 定价模式与实验
  4. 降低流失率并最大化用户终身价值
← 返回 Indie Hacker Mobile Apps