Để thảo luận và đưa ra ý kiến phản hồi về các sản phẩm của chúng tôi, hãy tham gia kênh Discord chính thức của AdMob trong máy chủ Cộng đồng quảng cáo và đo lường của Google.
Bước đầu tiên để hiển thị quảng cáo và kiếm doanh thu là tích hợp SDK Quảng cáo của Google trên thiết bị di động vào một ứng dụng Flutter. Sau khi tích hợp SDK, bạn có thể tiến hành triển khai một hoặc nhiều định dạng quảng cáo được hỗ trợ.
Mã ứng dụng AdMob phải được đưa vào AndroidManifest.xml.
Nếu không, ứng dụng sẽ bị lỗi khi khởi chạy.
Thêm mã ứng dụng AdMob (được xác định trong giao diện web AdMob) vào tệp android/app/src/main/AndroidManifest.xml của ứng dụng bằng cách thêm thẻ <meta-data> có tên là com.google.android.gms.ads.APPLICATION_ID.
Đối với android:value, hãy chèn mã ứng dụng của riêng bạn trong dấu ngoặc kép như minh hoạ:
Sử dụng cùng một value khi bạn khởi chạy trình bổ trợ trong mã Dart.
Xem hướng dẫn dành cho Android để biết thêm thông tin về cách định cấu hình AndroidManifest.xml và thiết lập mã ứng dụng.
iOS
Cập nhật tệp Info.plist
Trong tệp ios/Runner/Info.plist của ứng dụng, hãy thêm một khoá GADApplicationIdentifier có giá trị chuỗi là mã ứng dụng AdMob của bạn, như được xác định trong giao diện web AdMob:
Bạn phải chuyển cùng một giá trị khi khởi chạy trình bổ trợ trong mã Dart của mình.
Xem hướng dẫn dành cho iOS để biết thêm thông tin về cách định cấu hình Info.plist và thiết lập mã ứng dụng.
Khởi chạy SDK quảng cáo trên thiết bị di động
Trước khi tải quảng cáo, hãy để ứng dụng của bạn khởi chạy SDK Quảng cáo của Google trên thiết bị di động bằng cách gọi MobileAds.instance.initialize(). Lệnh gọi này sẽ khởi chạy SDK và trả về một Future hoàn thành sau khi quá trình khởi chạy hoàn tất hoặc sau khi hết thời gian chờ 30 giây. Gọi initialize() càng sớm càng tốt.
// Initialize the Mobile Ads SDK.MobileAds.instance.initialize();
Sau khi nhập SDK Quảng cáo của Google trên thiết bị di động, bạn đã sẵn sàng triển khai quảng cáo.
AdMob cung cấp nhiều định dạng quảng cáo để bạn có thể chọn định dạng phù hợp nhất với trải nghiệm người dùng trong ứng dụng của mình.
Biểu ngữ
Quảng cáo hình chữ nhật xuất hiện ở đầu hoặc cuối màn hình thiết bị. Quảng cáo biểu ngữ lưu lại trên màn hình trong khi người dùng tương tác với ứng dụng, và có thể tự động làm mới sau một khoảng thời gian nhất định. Nếu bạn mới sử dụng quảng cáo trên thiết bị di động, thì đây là loại quảng cáo rất phù hợp để bắt đầu.
Quảng cáo toàn màn hình che phủ giao diện của một ứng dụng cho đến khi người dùng đóng lại.
Bạn nên sử dụng định dạng quảng cáo này tại các điểm dừng tự nhiên trong luồng thực thi của ứng dụng, chẳng hạn như giữa các cấp độ của trò chơi hoặc ngay sau khi hoàn thành một nhiệm vụ.
Quảng cáo có thể tuỳ chỉnh và phù hợp với giao diện ứng dụng của bạn. Bạn quyết định cách thức và vị trí đặt quảng cáo, do đó, bố cục quảng cáo sẽ phù hợp hơn với kiểu thiết kế ứng dụng của bạn.
Quảng cáo tặng thưởng cho người dùng khi họ xem những video ngắn và tương tác với cuộc khảo sát hoặc quảng cáo
có thể chơi. Phù hợp để kiếm tiền từ người chơi miễn phí.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-09-06 UTC."],[[["\u003cp\u003eThis guide explains how to integrate the Google Mobile Ads SDK into a Flutter app to display AdMob ads and earn revenue.\u003c/p\u003e\n"],["\u003cp\u003ePublishers need to meet prerequisites such as minimum Flutter and Android/iOS versions, and ideally create and register an AdMob account.\u003c/p\u003e\n"],["\u003cp\u003eThe integration process involves importing the SDK, platform-specific setup (Android/iOS), and initializing the Mobile Ads SDK before loading ads.\u003c/p\u003e\n"],["\u003cp\u003eAdMob offers various ad formats including banner, interstitial, native, and rewarded, each with its own implementation guide linked in the document.\u003c/p\u003e\n"],["\u003cp\u003eYou can choose the format best suited for your app and follow the respective guide for detailed implementation instructions.\u003c/p\u003e\n"]]],["Publishers integrating AdMob ads into a Flutter app must first include the Google Mobile Ads SDK plugin. They then update `AndroidManifest.xml` (Android) and `Info.plist` (iOS) with their AdMob app ID. Before loading ads, they initialize the SDK using `MobileAds.instance.initialize()`. Finally, publishers can select an ad format: banner, interstitial, native, or rewarded, based on their app's user experience. The document provides further links for setting up the app and ad formats.\n"],null,["Select platform: [Android](/admob/android/quick-start \"View this page for the Android platform docs.\") [iOS](/admob/ios/quick-start \"View this page for the iOS platform docs.\") [Unity](/admob/unity/quick-start \"View this page for the Unity platform docs.\") [Flutter](/admob/flutter/quick-start \"View this page for the Flutter platform docs.\")\n\n\u003cbr /\u003e\n\nIntegrating Google Mobile Ads SDK into a Flutter app is the first step\ntoward displaying ads and earning revenue. Once you've integrated the SDK, you\ncan proceed to implement one or more of the supported ad formats.\n\nPrerequisites\n\n- Flutter 3.27.0 or higher\n- Android\n - Latest version of Android Studio\n- iOS\n - Latest version of Xcode with [enabled command-line\n tools](//flutter.dev/docs/get-started/install/macos#install-xcode)\n\nImport Google Mobile Ads SDK\n\n- Include the [Google Mobile Ads SDK for Flutter\n plugin](//pub.dev/packages/google_mobile_ads/install) in your Flutter project.\n\nPlatform specific setup\n\n\n| **Important:** Use the latest Google Mobile Ads SDK so that you have access to all the privacy compliance features.\n\n\u003cbr /\u003e\n\nAndroid\n\n**Update AndroidManifest.xml**\n\nThe AdMob app ID must be included in the `AndroidManifest.xml`.\nFailure to do so results in a crash on app launch.\n\nAdd the AdMob app ID, as\n\n[identified in the AdMob web interface](//support.google.com/admob/answer/7356431),\n\nto the app's `android/app/src/main/AndroidManifest.xml` file by adding a\n`\u003cmeta-data\u003e` tag with the name `com.google.android.gms.ads.APPLICATION_ID`.\nFor `android:value`, insert your own app ID in quotes as shown: \n\n \u003cmanifest\u003e\n \u003capplication\u003e\n \u003c!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 --\u003e\n \u003cmeta-data\n android:name=\"com.google.android.gms.ads.APPLICATION_ID\"\n android:value=\"ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy\"/\u003e\n \u003capplication\u003e\n \u003cmanifest\u003e\n\nUse the same `value` when you initialize the plugin in your Dart code.\n\nSee the\n\n[Android guide](/admob/android/quick-start#update_your_androidmanifestxml)\n\nfor more information about configuring `AndroidManifest.xml` and setting up\nthe app ID.\n\niOS\n\n**Update Info.plist**\n\nIn your app's `ios/Runner/Info.plist` file, add a `GADApplicationIdentifier`\nkey with a string value of your AdMob app ID, as\n[identified in the AdMob web interface](//support.google.com/admob/answer/7356431): \n\n \u003ckey\u003eGADApplicationIdentifier\u003c/key\u003e\n \u003cstring\u003eca-app-pub-################~##########\u003c/string\u003e\n\nYou must pass the same value when you initialize the plugin in your Dart code.\n\nSee the\n\n[iOS guide](/admob/ios/quick-start#update_your_infoplist)\n\nfor more information about configuring `Info.plist` and setting up the app ID.\n\nInitialize the Mobile Ads SDK\n\nBefore loading ads, have your app initialize Google Mobile Ads SDK by calling\n[`MobileAds.instance.initialize()`](//pub.dev/documentation/google_mobile_ads/latest/google_mobile_ads/MobileAds/initialize.html)\nwhich initializes the SDK and returns a `Future` that finishes once\ninitialization is complete, or after a 30-second timeout. Call `initialize()`\nas early as possible. \n\n // Initialize the Mobile Ads SDK.\n MobileAds.instance.initialize(); \n https://github.com/googleads/googleads-mobile-flutter/blob/82c58b3202d8b9391e4d3ec39b045032e90cf331/samples/admob/banner_example/lib/main.dart#L229-L230\n\nSelect an ad format\n\nAfter Google Mobile Ads SDK is imported, you're ready to implement an ad.\nAdMob offers a number of different ad formats, so you can choose\nthe one that best fits your app's user experience.\n\nBanner\n\nRectangular ads that appear at the top or bottom of the device screen. Banner\nads stay on screen while users are interacting with the app, and can refresh\nautomatically after a certain period of time. If you're new to mobile\nadvertising, they're a great place to start. \n\n[Implement a Banner ad](/admob/flutter/banner)\n\nInterstitial\n\nFull-screen ads that cover the interface of an app until closed by the user.\nThey're best used at natural pauses in the flow of an app's execution, such as\nin between levels of a game or just after completing a task. \n\n[Implement an Interstitial ad](/admob/flutter/interstitial)\n\nNative\n\nCustomizable ads that match the look and feel of your app. You decide how and\nwhere they're placed, so the layout is more consistent with your app's design. \n\n[Implement a Native ad](/admob/flutter/native)\n\nRewarded\n\nAds that reward users for watching short videos and interacting with playable\nads and surveys. Good for monetizing free-to-play users. \n\n[Implement a Rewarded ad](/admob/flutter/rewarded)"]]