整合 AdFalcon 與中介服務
本指南適用於有意使用 Google 行動廣告中介服務搭配 AdFalcon 的發布商。這份文件會逐步說明如何設定中介服務轉接程式,以便與目前的 Android 應用程式搭配運作,以及如何設定其他設定。
必要條件
實用的入門指南
以下說明中心文章提供仲裁的背景資訊:
將 AdFalcon 新增至專案
加入網路轉接程式和 SDK
請從上述連結下載 AdFalcon 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'])
// ...
}
按照 AdFalcon 說明文件中的指示修改 AndroidManifest.xml
檔案。
您的應用程式不需要直接呼叫 AdFalcon,Google Mobile Ads SDK 會呼叫 AdFalcon 轉接器,代表您擷取廣告。如有需要,您可以指定任何其他要求參數。本頁其餘部分會詳細說明如何向 AdFalcon 提供更多資訊。
使用活動例項初始化廣告物件
在新廣告物件 (例如 AdView
) 的建構函式中,您必須傳入 Context
類型的物件。使用中介服務時,這個 Context
會傳遞至其他廣告聯播網。部分廣告聯播網需要使用限制較嚴格的 Context
,類型為 Activity
,且可能無法在沒有 Activity
執行個體的情況下放送廣告。因此,建議您在初始化廣告物件時傳入 Activity
例項,確保中介廣告聯播網的一致體驗。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-03-01 (世界標準時間)。
[null,null,["上次更新時間:2025-03-01 (世界標準時間)。"],[[["This guide helps publishers integrate AdFalcon with Google Mobile Ads mediation in their Android apps."],["You need an existing Android app with the Google Mobile Ads SDK and an AdMob account with configured ad units."],["Integration involves adding the AdFalcon SDK and adapter to your project and configuring your AndroidManifest.xml file."],["The Google Mobile Ads SDK handles communication with the AdFalcon adapter to fetch ads, but you can customize request parameters if needed."],["Initializing your ad objects with an Activity instance is recommended for optimal performance with mediated ad networks."]]],["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"]]