Integrate Line with Mediation (Beta)

本指南将向您介绍如何使用 Google 移动广告 SDK 通过 中介、(涵盖广告瀑布流集成)加载和展示广告。其中介绍了如何向广告单元的中介配置添加 Line,以及如何将 Line SDK 和适配器集成到 Android 应用中。

Line 的信息中心界面使用日语文本作为标签、按钮和说明。本指南中的屏幕截图尚未翻译。不过,在本指南的说明和说明中,标签和按钮在翻译后会用英文括号括起来。

支持的集成和广告格式

Line 的中介适配器具有以下功能:

集成
出价
瀑布  1
表现形式
横幅
插页式广告
已奖励
原生

1 广告瀑布流集成目前处于封闭式 Beta 版测试阶段,如需申请访问权限,请与您的客户经理联系。

要求

  • Android API 级别 21 或更高级别
  • 最新版 Google 移动广告 SDK

  • 看完中介服务入门指南

第 1 步:在 Line 界面中设置配置

Log in to your Line account.

Add a new application

Click 広告枠管理 (Ad Slot Management) > メディア (Media). Then, click 新規作成 (Create New).

Fill out the form and click 登録 (Register).

Take note of the Application ID.

Create an ad placement

Click the ID of the application you want to add an ad placement. Then, select 詳細 (Detail).

Click スロット 追加 (Add Slot).

Fill out the form and once done, click (登録) Register.

Take note of the Slot ID.

第 2 步:在界面中设置 Ad Manager 订单项需求

Configure mediation settings for your ad unit

Sign in to your Ad Manager account.

Navigate to Delivery > Yield groups and click the New yield group button.

Enter a unique Name for your yield group, set the Status to Active, select your Ad Format, and set the Inventory type to Mobile App. Under the Targeting > Inventory section, select the ad unit under Inventory and Mobile application to which you want to add mediation.

Next, click the Add yield partner button.

If you already have a Yield partner for Line, you can select it. Otherwise, select Create a new yield partner.

Select Line as the Ad network, enter a unique Name and enable Mediation.

Once the Yield partner is selected, choose Mobile SDK Mediation as the Integration type, Android as the Platform, and Active as the Status. Enter the Application ID and Slot ID obtained in the previous section. Then, enter a Default CPM value.

Click Save at the bottom of the page when done.

第 3 步:导入 Line SDK 和适配器

在应用级 build.gradle.kts 文件中,添加以下实现依赖项和配置。使用最新版本的 Line SDK 和适配器:

dependencies {
    implementation("com.google.android.gms:play-services-ads:23.2.0")
    implementation("com.google.ads.mediation:line:2.7.20240515.0")
}

手动集成

  1. 下载最新版本的 Line SDK.aar 文件并将其添加到您的项目。

  2. 转到 Google 的 Maven 制品库中的线路适配器工件。选择最新版本,下载 Line 适配器的 .aar 文件并将其添加到您的项目。

第 4 步:添加所需的代码

LINE 集成无需额外代码。

第 5 步:测试实现效果

Enable test ads

Make sure you register your test device for Ad Manager.

Follow the instructions in Line's documentation on how to enable Line test ads.

Verify test ads

To verify that you are receiving test ads from Line, enable single ad source testing in ad inspector using the Line (Waterfall) ad source(s).

可选步骤

广告联盟专有参数

Line 适配器支持一个额外的请求参数,您可以使用 LineExtras 类将该参数传递到适配器。此类构造函数包含以下参数:

enableAdSound
一个 boolean,用于指定横幅广告、插页式广告和激励广告的默认声音启动状态。

以下示例代码展示了如何创建可设置这些参数的广告请求:

Java

LineExtras lineExtras = new LineExtras(true);
Bundle extras = lineExtras.build();

AdManagerAdRequest request = new AdManagerAdRequest.Builder()
   .addNetworkExtrasBundle(LineMediationAdapter.class, extras)
   .build();

Kotlin

val lineExtras = LineExtras(true)
val extras = lineExtras.build()

val request = AdManagerAdRequest.Builder()
   .addNetworkExtrasBundle(LineMediationAdapter::class.java, extras)
   .build()

使用原生广告

广告呈现

线路适配器会填充 NativeAd 的以下 字段

字段 素材资源始终包含在 Line Adapter 中
标题
映像
正文
应用图标 1
号召性用语
星级
商店
价格

1 对于原生广告,Line SDK 不提供应用图标素材资源。相反,Line 适配器使用透明图片填充应用图标。

错误代码

如果适配器未能收到来自 Line 的广告,您可以使用 ResponseInfo.getAdapterResponses() 在以下类下检查广告响应中的基本错误:

com.line.ads
com.google.ads.mediation.line.LineMediationAdapter

以下是广告加载失败时 Line 适配器抛出的代码及其附带的消息:

错误代码 网域 原因
1-10 com.five_corp.ad Line SDK 返回了与 SDK 相关的错误。如需了解详情,请参阅 Line 的文档
101 com.google.ads.mediation.line 应用 ID 缺失或无效。
102 com.google.ads.mediation.line 广告位 ID 缺失或无效。
103 com.google.ads.mediation.line 请求的广告尺寸与 Line 支持的横幅广告尺寸不匹配。
104 com.google.ads.mediation.line 由于缺少活动上下文,未能加载插页式广告或激励广告。
105 com.google.ads.mediation.line Line SDK 无法展示插页式广告或激励广告。
106 com.google.ads.mediation.line 由于缺少素材资源,无法加载原生广告。
1-10 由 Line SDK 发送 Line SDK 返回了与 SDK 相关的错误。如需了解详情,请参阅 Line 的文档
101 com.google.ads.mediation.line 服务器参数无效(例如,缺少应用 ID 或插槽 ID)。
102 com.google.ads.mediation.line 请求的广告尺寸与 Line 支持的横幅广告尺寸不匹配。
103 com.google.ads.mediation.line 未能在原生广告中加载信息图标图片素材资源。

LINE Android 中介适配器更新日志

版本 2.7.20240515.0

  • 将所需的最低 Google 移动广告 SDK 版本更新为 23.1.0。
  • 已验证与 FiveAd SDK 版本 2.7.20240515.0 的兼容性

构建和测试时所用平台:

  • Google 移动广告 SDK 23.1.0 版。
  • FiveAd SDK 版本 2.7.20240515.0

版本 2.7.20240214.1

  • 将所需的最低 Google 移动广告 SDK 版本更新为 23.0.0。
  • 已验证与 FiveAd SDK 版本 2.7.20240214.0 的兼容性。

构建和测试时所用平台:

  • Google 移动广告 SDK 版本 23.0.0。
  • FiveAd SDK 版本 2.7.20240214.0。

版本 2.7.20240214.0

  • 已验证与 FiveAd SDK 版本 2.7.20240214.0 的兼容性。

构建和测试时所用平台:

  • Google 移动广告 SDK 22.6.0 版。
  • FiveAd SDK 版本 2.7.20240214.0。

版本 2.7.20240126.0

  • 已验证与 FiveAd SDK 版本 2.7.20240126.0 的兼容性。

构建和测试时所用平台:

  • Google 移动广告 SDK 22.6.0 版。
  • FiveAd SDK 版本 2.7.20240126.0。

版本 2.7.20240112.0

  • 移除了已废弃的 FiveAdViewEventListener,取而代之的是 FiveAdCustomLayoutEventListenerFiveAdVideoRewardEventListenerFiveAdInterstitialEventListenerFiveAdNativeEventListener
  • 已验证与 FiveAd SDK 版本 2.7.20240112 的兼容性。
  • 将所需的最低 Google 移动广告 SDK 版本更新为 22.6.0。

构建和测试时所用平台:

  • Google 移动广告 SDK 22.6.0 版。
  • FiveAd SDK 版本 2.7.20240112。

版本 2.6.20230607.1

  • 为发布商添加了 LineExtras 类,以便为横幅广告、插页式广告和激励广告格式定义默认的声音设置。
  • 将所需的最低 Google 移动广告 SDK 版本更新为 22.4.0。

构建和测试时所用平台:

  • Google 移动广告 SDK 22.4.0 版。
  • FiveAd SDK 版本 2.6.20230607。

版本 2.6.20230607.0

  • 初始版本。
  • 添加对横幅广告、插页式广告、激励广告和原生广告格式的支持。
  • 已验证与 FiveAd SDK 版本 2.6.20230607 的兼容性。

构建和测试时所用平台:

  • Google 移动广告 SDK 22.1.0 版。
  • FiveAd SDK 版本 2.6.20230607。