启动广告检查器
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
在测试广告植入之前,您必须先在应用中启动广告检查器。本页介绍了如何使用手势启动广告检查器,以及如何以编程方式启动广告检查器。
前提条件
在继续之前,请执行以下操作:
- 完成初始前提条件中的所有项目,以创建 AdMob 账号、设置测试设备、初始化 Google 移动广告 SDK 并安装最新版本。
选择发布选项
您可以通过以下方式启动广告检查器:
- 注册测试设备后,使用您在 AdMob 界面中选择的手势。如需了解详情,请参阅设置测试设备。
- 通过方法以编程方式创建。
使用手势启动
如需通过手势启动广告检查器,请执行您在 AdMob 界面中为测试设备配置的手势,例如轻击两下或摇晃。如需了解详情,请参阅使用广告检查器测试应用。
在 AdMob 界面中设置手势后,请等待一段时间,让设置生效。通过 Google 移动广告 SDK 发出广告请求,以向测试设备注册手势设置。如果执行手势后无法在广告检查器中打开,请尝试加载广告、重启应用,然后再次测试手势。
以编程方式启动
运行以下命令以启动广告检查器:
MobileAds.instance.openAdInspector((error) {
// Error will be non-null if ad inspector closed due to an error.
});
此方法适用于以编程方式注册或在 AdMob 界面中注册的测试设备。如需了解详情,请参阅启用测试设备。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[],[],null,["# Launch ad inspector\n\nSelect platform: [Android](/admob/android/ad-inspector/launch-ad-inspector \"View this page for the Android platform docs.\") [iOS](/admob/ios/ad-inspector/launch-ad-inspector \"View this page for the iOS platform docs.\") [Unity](/admob/unity/ad-inspector/launch-ad-inspector \"View this page for the Unity platform docs.\") [Flutter](/admob/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\nusing gestures\nand how to launch\nprogrammatically.\n\nPrerequisites\n-------------\n\nBefore you continue, do the following:\n\n- Complete all items in the initial [Prerequisites](/admob/flutter/ad-inspector#prerequisites) to create an AdMob account, set your test device, initialize Google Mobile Ads SDK , and install the latest version.\n\nChoose a launch option\n----------------------\n\nYou can launch ad inspector in the following ways:\n\n- Use the gesture you selected in the AdMob UI after registering a test device. For details, see [Set up a test device](https://support.google.com/admob/answer/9691433).\n- Programmatically through a method.\n\n### Launch using gestures\n\nTo launch ad inspector with a gesture, perform the gesture, such as a double\nflick or shake, that you configured in AdMob UI for your test\ndevice. For more details, see\n[Test your app with ad inspector](https://support.google.com/admob/answer/10159602).\n\nAfter you set a gesture in the AdMob UI, allow time to propagate. Make an ad\nrequest through the\n\nGoogle Mobile Ads SDK\n\nto register your\ngesture setting with your test device. If performing your gesture fails to\nopen in ad inspector, try to load an ad, restart your app, and test the gesture\nagain.\n\n### Launch programmatically\n\nLaunch ad inspector by running the following: \n\n MobileAds.instance.openAdInspector((error) {\n // Error will be non-null if ad inspector closed due to an error.\n });\n\nThis method works for test devices registered\nprogrammatically or in the AdMob UI.\nFor more details, see\n[Enable test devices](/admob/flutter/test-ads#enable_test_devices)."]]