搜索插件、代码仓与 APP 分类

easy_admob_ads_flutter 封面
插件详情v2.0.3

easy_admob_ads_flutter

一个简单且灵活的 Flutter 包,用于以最少的设置集成 AdMob 广告格式。

AndroidiOS
近 30 天下载
388
喜欢数
8
Pub 分数
160

安装插件

flutter pub add easy_admob_ads_flutter

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

EasyAdmobAdsFlutter 是一个轻量级的 Flutter 包,旨在简化在移动应用程序中集成 AdMob 广告格式的过程。通过最少的设置,它使开发者能够快速在 Android 和 iOS 平台上实现横幅广告、插页广告和激励广告。该包抽象了复杂的配置步骤,提供直观的 API 进行广告管理。它支持实时加载广告,并提供回调以跟踪用户交互,非常适合轻松实现应用变现。

适合场景

  • 通过横幅广告 monetizing 移动应用
  • 在应用界面之间显示插页广告
  • 实施奖励视频广告以激励用户
  • 无需深入了解平台特定知识即可集成 AdMob
  • 在开发过程中启用快速广告测试

主要特点

  • 简单的设置,只需几行代码
  • 支持多种 AdMob 广告类型
  • 跨平台兼容性(Android 和 iOS)
  • 内置的广告互动事件监听器
  • 所需的最小样板代码

适合对象

  • Flutter 开发者新手 AdMob
  • 需要快速广告集成的应用程序
  • 开发周期紧张的项目
  • 寻求低维护广告解决方案的开发者
  • 教育或爱好者应用程序创作者

使用建议

  • 需要有效的 AdMob 帐户和广告单元 ID
  • 依赖于 Google 移动广告 SDK
  • 可能需要为某些广告类型添加额外权限
  • 不适用于超出基本广告处理的高级自定义
  • 与官方 SDK 相比,文档有限

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Stand With Palestine

Easy AdMob Integration for Flutter

pub package Pub Points Last Commit Pull Requests Code Size License

A simple, configurable Flutter wrapper for Google AdMob. One EasyAdMobAds.instance sets up the SDK, GDPR/UMP consent, and a global on/off switch for ads. All six ad formats are supported with their own controller or widget.

Show some ❤️ by giving the repo a ⭐ and liking 👍 the package on pub.dev!

Screenshots

Static AdMob Demo Animated AdMob Demo Static AdMob Demo

Features

  • Banner (adaptive, optionally collapsible)
  • Interstitial
  • Rewarded
  • Rewarded Interstitial
  • App Open (auto-preloaded and shown on app resume)
  • Native (small/medium templates)
  • GDPR/UMP consent flow, including the "privacy options" re-consent form
  • App Tracking Transparency (ATT) consent on iOS 14.5+, requested automatically during initialize()
  • Network connectivity awareness — ad requests pause while offline and resume as soon as connectivity returns

Getting started

1. Install
dependencies:
  easy_admob_ads_flutter: ^<latest_version>
2. Platform setup

Add your AdMob App ID:

Android — android/app/src/main/AndroidManifest.xml:

<meta-data
  android:name="com.google.android.gms.ads.APPLICATION_ID"
  android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>

iOS — ios/Runner/Info.plist:

<key>GADApplicationIdentifier</key>
<string>ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy</string>
3. Initialize
void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await EasyAdMobAds.instance.initialize(
    config: const EasyAdsConfig(
      androidAdUnitIds: {
        AdType.banner: 'ca-app-pub-.../...',
        AdType.interstitial: 'ca-app-pub-.../...',
      },
      iosAdUnitIds: {
        AdType.banner: 'ca-app-pub-.../...',
        AdType.interstitial: 'ca-app-pub-.../...',
      },
      testDeviceIds: ['YOUR_TEST_DEVICE_ID'],
    ),
  );

  runApp(const MyApp());
}

Any AdType you don't configure automatically falls back to a Google test ad unit ID (with a warning logged), so the package works out of the box during development.

Usage

// Banner
const EasyBannerAd(collapsible: true, height: 100)

// Native
EasyNativeAd.medium()

// Interstitial
final interstitialAd = EasyInterstitialAd()..loadAd();
await interstitialAd.showAd();

// Rewarded
final rewardedAd = EasyRewardedAd(onRewardEarned: (reward) {
  // grant the reward
})..loadAd();
await rewardedAd.showAd();

// Rewarded Interstitial
final rewardedInterstitialAd = EasyRewardedInterstitialAd(onRewardEarned: (reward) {
  // grant the reward
})..loadAd();
await rewardedInterstitialAd.showAd();

// App Open — preloaded automatically; show it manually if you want:
await EasyAdMobAds.instance.appOpenAd?.showAdIfAvailable();

// Turn all ads on/off (e.g. after a "remove ads" purchase)
EasyAdMobAds.instance.adsEnabled = false;

// GDPR privacy options
if (EasyAdMobAds.instance.isPrivacyOptionsRequired) {
  EasyAdMobAds.instance.showPrivacyOptionsForm();
}

See the example/ app for a full demo screen with all ad types, the on/off switch, and the consent button wired up.

Author

Huzaib Sayyed

GitHub LinkedIn

所属分类

依赖

依赖清单 6 项

源码仓库

使用此插件的项目

暂无相关数据。