启动广告检查器
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
在测试广告植入之前,您必须先在应用中启动广告检查器。本页介绍了如何通过调试菜单启动广告检查器,以及如何以编程方式启动广告检查器。
前提条件
在继续之前,请执行以下操作:
- 完成初始前提条件中的所有项目,以创建 Ad Manager 账号、设置测试设备、初始化 Google 移动广告 SDK 并安装最新版本。
选择发布选项
您可以通过以下方式启动广告检查器:
- 通过应用内的调试菜单启动按钮,使用您在广告检查器设置中选择的手势。
- 通过 Google 移动广告 SDK 以编程方式进行。
如需通过调试菜单启动广告检查器,您无需对应用进行进一步更改。如需了解详情,请参阅检查移动应用广告投放情况。
请完成以下步骤:
- 找到在您的 Ad Manager 广告资源网中投放的广告。
- 轻触并按住相应广告以打开调试菜单。
- 选择打开广告检查器。
如果您没有关联设备,可能需要登录 Ad Manager 账号。
您也可以从调试设置中选择“广告检查器”设置,然后选择一个手势;日后,直接使用该手势即可打开广告检查器。
以编程方式启动
运行以下命令以启动广告检查器:
Java
MobileAds.openAdInspector(
context,
new OnAdInspectorClosedListener() {
public void onAdInspectorClosed(@Nullable AdInspectorError error) {
// Error will be non-null if ad inspector closed due to an error.
}
});
Kotlin
MobileAds.openAdInspector(context) { error ->
// Error will be non-null if ad inspector closed due to an error.
}
此方法适用于以编程方式注册的测试设备。如需了解详情,请参阅启用测试设备。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[],[],null,["Select platform: [Android](/ad-manager/mobile-ads-sdk/android/ad-inspector/launch-ad-inspector \"View this page for the Android platform docs.\") [iOS](/ad-manager/mobile-ads-sdk/ios/ad-inspector/launch-ad-inspector \"View this page for the iOS platform docs.\") [Unity](/ad-manager/mobile-ads-sdk/unity/ad-inspector/launch-ad-inspector \"View this page for the Unity platform docs.\") [Flutter](/ad-manager/mobile-ads-sdk/flutter/ad-inspector/launch-ad-inspector \"View this page for the Flutter platform docs.\")\n\n\u003cbr /\u003e\n\nBefore you test your ad integration, you must launch ad inspector in your app.\nThis page covers how to launch ad inspector\nthrough the debug menu and how to launch\nprogrammatically.\n\nPrerequisites\n\nBefore you continue, do the following:\n\n- Complete all items in the initial [Prerequisites](/ad-manager/mobile-ads-sdk/android/ad-inspector#prerequisites) to create an Ad Manager account, set your test device, initialize Google Mobile Ads SDK, and install the latest version.\n\nChoose a launch option\n\nYou can launch ad inspector in the following ways:\n\n- The launch button from the debug menu within your app to use the gesture that you selected in the ad inspector settings.\n- Programmatically through the Google Mobile Ads SDK.\n\nLaunch using the debug menu\n\nTo launch ad inspector through the debug menu, you don't require further\nchanges on your app. For more details, see\n[Inspect mobile app ad delivery](//support.google.com/admanager/answer/7180401).\n\nComplete the following steps:\n\n1. Find an ad served in your Ad Manager network.\n2. Touch and hold the ad to open the debug menu.\n3. Select **Open ad inspector**.\n\nIf you didn't [link your device](/ad-manager/mobile-ads-sdk/android/debug#link_your_device), you might\nneed to sign in to your Ad Manager account.\n\nFrom the debug settings, you can also select **Ad inspector settings** and\nchoose a gesture that can open ad inspector.\n\nLaunch programmatically\n\nLaunch ad inspector by running the following: \n\nJava \n\n MobileAds.openAdInspector(\n context,\n new OnAdInspectorClosedListener() {\n public void onAdInspectorClosed(@Nullable AdInspectorError error) {\n // Error will be non-null if ad inspector closed due to an error.\n }\n }); \n https://github.com/googleads/googleads-mobile-android-examples/blob/ccc290a583d7f552bdcf81ea76adc05beaa43f0b/java/advanced/APIDemo/app/src/main/java/com/google/android/gms/snippets/AdInspectorSnippets.java#L28-L34\n\nKotlin \n\n MobileAds.openAdInspector(context) { error -\u003e\n // Error will be non-null if ad inspector closed due to an error.\n } \n https://github.com/googleads/googleads-mobile-android-examples/blob/ccc290a583d7f552bdcf81ea76adc05beaa43f0b/kotlin/advanced/APIDemo/app/src/main/java/com/google/android/gms/snippets/AdInspectorSnippets.kt#L25-L27\n\nThis method works for test devices registered programmatically. For more details, see\n[Enable test devices](/ad-manager/mobile-ads-sdk/android/test-ads#enable_test_devices)."]]