Tích hợp Tencent GDT với tính năng dàn xếp
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Hướng dẫn này dành cho những nhà xuất bản muốn sử dụng tính năng dàn xếp Quảng cáo trên thiết bị di động của Google với Tencent GDT. Tài liệu này hướng dẫn cách thiết lập một bộ chuyển đổi dàn xếp để hoạt động với ứng dụng Android hiện tại của bạn và cách định cấu hình các chế độ cài đặt bổ sung.
Điều kiện tiên quyết
Thông tin cơ bản hữu ích
Các bài viết sau đây trên Trung tâm trợ giúp cung cấp thông tin cơ bản về hoạt động dàn xếp:
Thêm Tencent GDT vào dự án của bạn
Bao gồm bộ chuyển đổi mạng và SDK
Tải SDK và bộ chuyển đổi Tencent GDT xuống từ các đường liên kết trước đó.
Trong Android Studio, hãy thêm tệp bộ chuyển đổi và SDK vào thư mục libs
của dự án. Đảm bảo rằng tệp Gradle cấp ứng dụng của bạn có chứa nội dung sau:
Kotlin
dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar", "*.jar"))))
// ...
}
Groovy
dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'])
// ...
}
Sửa đổi tệp AndroidManifest.xml
theo hướng dẫn trong tài liệu Tencent GDT.
Ứng dụng của bạn không cần gọi Tencent GDT trực tiếp – SDK quảng cáo trên thiết bị di động của Google sẽ gọi bộ chuyển đổi Tencent GDT để tìm nạp quảng cáo thay cho bạn. Nếu cần, bạn có thể chỉ định mọi tham số yêu cầu bổ sung.
Phần còn lại của trang này trình bày chi tiết cách cung cấp thêm thông tin cho Tencent GDT.
Khởi chạy đối tượng quảng cáo thông qua một phiên bản Activity
Trong hàm dựng cho một đối tượng quảng cáo mới (ví dụ: AdView
), bạn phải truyền vào một đối tượng thuộc loại Context
.
Hệ thống sẽ chuyển Context
này sang các mạng quảng cáo khác khi bạn sử dụng tính năng dàn xếp. Một số mạng quảng cáo yêu cầu Context
hạn chế hơn thuộc loại Activity
và không thể phân phát quảng cáo nếu không có phiên bản Activity
. Do đó, bạn nên chuyển vào một thực thể Activity
khi khởi chạy các đối tượng quảng cáo để đảm bảo trải nghiệm nhất quán với các mạng quảng cáo được dàn xếp.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-31 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-31 UTC."],[[["\u003cp\u003eThis guide explains how to integrate Tencent GDT ads into your Android app using Google Mobile Ads mediation.\u003c/p\u003e\n"],["\u003cp\u003ePublishers need an existing Android app with the Google Mobile Ads SDK and an AdMob account with configured mediation line items to begin.\u003c/p\u003e\n"],["\u003cp\u003eIntegration involves adding the Tencent GDT SDK and adapter to your project, configuring the AndroidManifest.xml, and initializing ad objects with an Activity instance.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Mobile Ads SDK handles communication with the Tencent GDT adapter; publishers don't need to directly interact with Tencent GDT.\u003c/p\u003e\n"]]],["This guide details how publishers can integrate Tencent GDT with Google Mobile Ads mediation in Android apps. Key actions include downloading the Tencent GDT SDK and adapter, adding them to the project's `libs` folder, and updating the `AndroidManifest.xml` file as per Tencent GDT's instructions. Additionally, it recommends initializing ad objects with an `Activity` instance for broader ad network compatibility. The Google Mobile Ads SDK manages ad requests via the Tencent GDT adapter.\n"],null,["# Integrate Tencent GDT with mediation\n\nThis guide is intended for publishers who are interested in using Google\nMobile Ads mediation with **Tencent GDT**. It walks\nthrough the setup of a mediation adapter to work with your current Android app\nand the configuration of additional settings.\n\n| Tencent GDT Resources |\n|------------------------------------------------------------------------------------------------------|\n| [Documentation](http://e.qq.com/dev/#index) |\n| [SDK](http://imgcache.qq.com/qzone/biz/gdt/dev/sdk/android/release/GDT_Android_SDK.zip) |\n| [Adapter](http://imgcache.qq.com/qzone/biz/gdt/dev/sdk/android/release/GDT_Android_ADMobAdapter.zip) |\n| [Customer support](mailto:GDTLM@tencent.com) |\n\nPrerequisites\n-------------\n\n- An Android app with\n\n Google Mobile Ads SDK\n\n integrated. (If you don't\n have one, see [Get Started](/admob/android/quick-start).)\n\n- An AdMob account and [an ad unit configured with mediation line\n items](//support.google.com/admob/answer/3124703).\n\nHelpful primers\n---------------\n\nThe following Help Center articles provide background information on mediation:\n\n- [About AdMob Mediation](//support.google.com/admob/answer/3063564)\n- [Set up AdMob Mediation](//support.google.com/admob/answer/3124703)\n- [Optimize AdMob Network](//support.google.com/admob/answer/3534471)\n\nAdd Tencent GDT to your project\n-------------------------------\n\n### Include network adapter and SDK\n\nDownload the Tencent GDT SDK and adapter from the\n[previous links](#resources).\n\nIn Android Studio, include the adapter and SDK files in your project's `libs`\nfolder. Make sure that your app-level Gradle file includes the following: \n\n### Kotlin\n\n dependencies {\n implementation(fileTree(mapOf(\"dir\" to \"libs\", \"include\" to listOf(\"\\*.aar\", \"\\*.jar\"))))\n // ...\n }\n\n### Groovy\n\n dependencies {\n implementation fileTree(dir: 'libs', include: \\['\\*.aar', '\\*.jar'\\])\n // ...\n }\n\n### Configure the AndroidManifest.xml file\n\nModify your `AndroidManifest.xml` file as instructed in the\nTencent GDT documentation.\n\nYour app doesn't need to call Tencent GDT\ndirectly---\n\nGoogle Mobile Ads SDK\n\ncalls the\nTencent GDT adapter to fetch ads on your behalf. If necessary, you can\nspecify any additional request parameters.\nThe rest of this page details how to provide more information to\nTencent GDT.\n\n### Initialize your ad object with an Activity instance\n\nIn the constructor for a new ad object (for example,\n\n[`AdView`](/admob/android/reference/com/google/android/gms/ads/AdView)),\n\nyou must pass in an object of type\n[`Context`](//developer.android.com/reference/android/content/Context).\nThis `Context` is passed on to other ad networks when using mediation. Some\nad networks require a more restrictive `Context` that is of type\n[`Activity`](//developer.android.com/reference/android/app/Activity)\nand may not be able to serve ads without an `Activity` instance. Therefore,\nwe recommend passing in an `Activity` instance when initializing ad objects\nto ensure a consistent experience with your mediated ad networks."]]