将 Leadbolt 与中介集成
本指南面向有兴趣将 Google 移动广告中介与 Leadbolt 搭配使用发布商。该部分将详细介绍如何设置中介适配器以与您当前的 Android 应用搭配使用,以及如何配置其他设置。
前提条件
实用入门指南
以下帮助中心文章提供了有关调解的背景信息:
将 Leadbolt 添加到您的项目
添加广告联盟适配器和 SDK
从上文中的链接下载 Leadbolt SDK 和适配器。
在 Android Studio 中,将适配器和 SDK 文件添加到项目的 libs
文件夹中。确保您的应用级 Gradle 文件包含以下内容:
dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar", "*.jar"))))
// ...
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'])
// ...
}
按照 Leadbolt 文档中的说明修改 AndroidManifest.xml
文件。
您的应用无需直接调用 Leadbolt,Google 移动广告 SDK 会调用 Leadbolt 适配器来代表您提取广告。如有必要,您可以指定任何其他请求参数。本页的其余部分将详细介绍如何向 Leadbolt 提供更多信息。
使用 activity 实例初始化您的广告对象
在新广告对象(例如 AdView
)的构造函数中,您必须传入类型为 Context
的对象。使用中介时,此 Context
会传递到其他广告联盟。某些广告联盟需要类型为 Activity
且条件更严格的 Context
,并且如果没有 Activity
实例,可能无法投放广告。因此,我们建议在初始化广告对象时传入 Activity
实例,以确保从您的所有中介广告联盟获得一致的体验。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-01。
[null,null,["最后更新时间 (UTC):2025-03-01。"],[[["This guide helps publishers integrate Leadbolt ads into their Android apps through AdMob mediation."],["You need an Android app with the Google Mobile Ads SDK and an AdMob account with configured ad units to get started."],["The process involves adding the Leadbolt SDK and adapter, configuring the AndroidManifest.xml file, and initializing ad objects with an Activity instance."],["Refer to the provided Leadbolt resources and helpful primers for detailed instructions and background information."]]],["This guide details integrating Leadbolt with Google Mobile Ads mediation for Android apps. Key actions include: downloading the Leadbolt SDK and adapter, adding them to the project's `libs` folder, and modifying the `AndroidManifest.xml` file as per Leadbolt's instructions. The guide emphasizes that the Google Mobile Ads SDK handles ad fetching, not the app directly. It also recommends initializing ad objects with an `Activity` instance for compatibility with mediated ad networks.\n"]]