パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v2.0.1

admob_easy

Google AdMob との統合を簡単にし、Flutter アプリの収益化をスムーズにします。

AndroidiOS
30日間ダウンロード
159
いいね数
26
Pub ポイント
130

パッケージをインストール

flutter pub add admob_easy

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

admob_easy は、Google AdMob との統合を簡素化する Flutter パッケージであり、開発者が Android および iOS アプリに広告を迅速に追加できるようにします。バナー、インタースティシャル、リワード広告の表示に使いやすい API を提供し、ネイティブ広告実装に関する深い知識が不要です。パッケージは初期化と広告読み込みをスムーズに処理し、ボイラープレートコードを減らし、収益化プロセスを簡素化します。アプリから収益を得たい開発者にとって理想的です。

用途

  • バナー広告によるモバイルアプリの収益化
  • アプリの画面の間でインテルスティシャル広告を表示する
  • ユーザーインセンティブ用の報酬付き動画広告の実装
  • ネイティブコードなしでクイック広告統合を追加
  • 中小規模のプロジェクト向けにアプリ内広告を有効化する

主な機能

  • 広告配置のためのシンプルな API
  • バナー広告、インテーシャル広告、報酬付き広告のサポート
  • 自動広告初期化
  • クロスプラットフォーム互換性(AndroidおよびiOS)
  • 最小限のセットアップが必要

適している対象

  • 初心者のFlutter開発者
  • 迅速な広告統合を必要とするアプリ
  • 開発期間が限られたプロジェクト
  • インディー開発者が収益化に焦点を当てる
  • 小さなから中程度のアプリで、簡単な広告サポートを探している

注意事項

  • Google AdMob アカウントのセットアップが必要です
  • 広告のパフォーマンスはネットワークの利用可能性に依存します
  • AdMobポリシーの遵守が必要になる場合があります
  • ネイティブSDKと比べてカスタマイズの選択肢が限られている
  • 複雑な広告ロジックや高度なターゲティングには適していません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Admob Easy

This documentation guides integrating ads into a Flutter application using the provided helper classes.
AdMob Easy automatically handles the User Messaging Platform (UMP) for you, ensuring compliance with privacy regulations.


Android Manifest File (Android)

<manifest>
    ...
    <application>
       ...
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-3940256099942544~3347511713"/>
    </application>
</manifest>

iOS Info.plist File (iOS)

...
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>
...

Initialize MobileAds

To enable ad support, initialize AdmobEasy in the Splash Screen by providing the necessary ad unit IDs and test devices:

AdmobEasy.instance.initialize(
  androidRewardedAdID: 'ca-app-pub-3940256099942544/5224354917',
  androidInitAdID: 'ca-app-pub-3940256099942544/1033173712',
  androidBannerAdID: 'ca-app-pub-3940256099942544/6300978111',
  androidAppOpenAdID: 'ca-app-pub-3940256099942544/9257395921',
  testDevices: ['543E082C0B43E6BF17AF6D4F72541F51'],
);

Load Ads

Use the provided methods to load ads:

AdmobEasy.instance.createRewardedAd(context);    // Load rewarded ad
AdmobEasy.instance.createInterstitialAd(context); // Load Interstitial ad
AdmobEasy.instance.loadAppOpenAd();              // Load App Open Ad (shows automatically after load)

Show Ads

Once ads are loaded, show them using:

AdmobEasy.instance.showRewardedAd(context);
AdmobEasy.instance.showInterstitialAd(context);

Native Ads (New API)

Native ads are now handled via methods mixed directly into AdmobEasy.
You can preload, show, and dispose native ads with full control.


Load a Native Ad

AdmobEasy.instance.loadNativeAd(
  templateType: TemplateType.medium,
  minWidth: 320,
  minHeight: 90,
  maxWidth: 400,
  maxHeight: 200,
  adID: "ca-app-pub-3940256099942544/2247696110", // optional custom ID
  onAdClicked: (ad) => print("Ad Clicked"),
  onAdImpression: (ad) => print("Ad Impression Logged"),
  onAdClosed: (ad) => print("Ad Closed"),
  onAdOpened: (ad) => print("Ad Opened"),
  onAdWillDismissScreen: (ad) => print("Ad will dismiss screen"),
  onPaidEvent: (ad, value, precision, currencyCode) {
    print("Paid event: $value $currencyCode (precision: $precision)");
  },
);

Show a Native Ad

Once preloaded, show it anywhere in the widget tree:

class NativeAdScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Native Ad Example')),
      body: Center(
        child: AdmobEasy.instance.showNativeAd(
          minWidth: 320,
          minHeight: 90,
          maxWidth: 400,
          maxHeight: 200,
        ),
      ),
    );
  }
}

Dispose a Native Ad

When you no longer need the preloaded ad:

@override
void dispose() {
  AdmobEasy.instance.disposeNative();
  super.dispose();
}

Parameters

  • adID → Custom AdMob Unit ID (if null, defaults to AdmobEasy.instance.nativeAdID).
  • templateType → Choose between TemplateType.small or TemplateType.medium.
  • minWidth, minHeight, maxWidth, maxHeight → Controls the size of the ad container.
  • onAdClicked → Callback when the ad is clicked.
  • onAdImpression → Callback when an ad impression is logged.
  • onAdClosed → Callback when the ad is closed.
  • onAdOpened → Callback when the ad is opened.
  • onAdWillDismissScreen → Callback when the ad is about to dismiss the screen.
  • onPaidEvent → Callback for handling paid events from the ad.

Best Practices for Native Ads

✅ Preload early – Call loadNativeAd() on your splash screen or just before the screen where the ad will be shown.
✅ Dispose when unused – Always call disposeNative() when leaving the screen to free memory.
✅ Avoid multiple preload calls – The mixin ensures only one native ad is preloaded at a time.
✅ Handle callbacks – Use onAdClicked, onAdImpression, and onPaidEvent to track engagement and revenue.
✅ Fallback UI – If no ad is preloaded, showNativeAd() automatically shows a loading placeholder.


Internet Connectivity

Admob Easy automatically checks if the device is online before loading ads.

You can check connectivity manually:

AdmobEasy.instance.isConnected.value; // true if connected

Or use a listener:

ValueListenableBuilder(
  valueListenable: ConnectivityController.instance.isConnected,
  builder: (_, value, child) {
    return Text(value ? "Connected" : "No Internet");
  },
);

You can also initialize connectivity monitoring:

AdmobEasy.instance.initConnectivity(
  onOnline: () => print("Online"),
  onOffline: () => print("Offline"),
);

Support

If you find this package useful and want to support its development, you can buy me a coffee:

Buy Me a Coffee

Thank you for your support!


Contributions are welcome!

Feel free to submit bug reports, feature requests, or pull requests on GitHub.

カテゴリー

依存関係

依存関係一覧 4 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。