将 AdFalcon 与中介集成
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本指南适用于希望将 Google 移动广告中介与 AdFalcon 搭配使用的发布商。本指南将逐步介绍如何设置中介适配器以与您当前的 Android 应用搭配使用,以及如何配置其他设置。
前提条件
实用的入门信息
以下帮助中心文章提供了有关中介的背景信息:
将 AdFalcon 添加到项目中
添加广告资源网适配器和 SDK
从前文中的链接下载 AdFalcon SDK 和适配器。
在 Android Studio 中,将适配器和 SDK 文件添加到项目的 libs
文件夹中。确保您的应用级 Gradle 文件包含以下内容:
Kotlin
dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar", "*.jar"))))
// ...
}
Groovy
dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'])
// ...
}
按照 AdFalcon 文档中的说明修改 AndroidManifest.xml
文件。
您的应用无需直接调用 AdFalcon,Google 移动广告 SDK 会调用 AdFalcon 适配器来代表您提取广告。如有必要,您可以指定任何其他请求参数。本页面的其余部分详细介绍了如何向 AdFalcon 提供更多信息。
使用 Activity 实例初始化您的广告对象
在新广告对象(例如 AdView
)的构造函数中,您必须传入类型为 Context
的对象。使用中介时,此 Context
会传递到其他广告联盟。某些广告联盟需要类型为 Activity
且条件更严格的 Context
,并且如果没有 Activity
实例,可能无法投放广告。因此,我们建议在初始化广告对象时传入 Activity
实例,以确保从您所有参与中介的广告联盟获得一致的体验。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[[["\u003cp\u003eThis guide helps publishers integrate AdFalcon with Google Mobile Ads mediation in their Android apps.\u003c/p\u003e\n"],["\u003cp\u003eYou need an existing Android app with the Google Mobile Ads SDK and an AdMob account with configured ad units.\u003c/p\u003e\n"],["\u003cp\u003eIntegration involves adding the AdFalcon SDK and adapter to your project and configuring your AndroidManifest.xml file.\u003c/p\u003e\n"],["\u003cp\u003eThe Google Mobile Ads SDK handles communication with the AdFalcon adapter to fetch ads, but you can customize request parameters if needed.\u003c/p\u003e\n"],["\u003cp\u003eInitializing your ad objects with an Activity instance is recommended for optimal performance with mediated ad networks.\u003c/p\u003e\n"]]],["Publishers integrate Google Mobile Ads mediation with AdFalcon by downloading the AdFalcon SDK and adapter. Include these files in the Android project's `libs` folder and modify the `AndroidManifest.xml` file as per AdFalcon documentation. Ensure the app-level Gradle file includes the implementation for these files. Initialize ad objects with an `Activity` instance for consistent network experience. The Google Mobile Ads SDK then handles fetching ads via the AdFalcon adapter.\n"],null,["# Integrate AdFalcon with mediation\n\nThis guide is intended for publishers who are interested in using Google\nMobile Ads mediation with **AdFalcon**. It walks\nthrough the setup of a mediation adapter to work with your current Android app\nand the configuration of additional settings.\n\n| AdFalcon Resources |\n|-----------------------------------------------------|\n| [Documentation](http://adfalcon.com) |\n| [SDK](http://www.adfalcon.com/en/download-sdk.html) |\n| [Adapter](http://www.adfalcon.com/en/adapters.html) |\n| [Customer support](mailto:support@adfalcon.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 AdFalcon to your project\n----------------------------\n\n### Include network adapter and SDK\n\nDownload the AdFalcon 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\nAdFalcon documentation.\n\nYour app doesn't need to call AdFalcon\ndirectly---\n\nGoogle Mobile Ads SDK\n\ncalls the\nAdFalcon 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\nAdFalcon.\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."]]