使用 RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("289.......E6") 在此设备上获取测试广告 [英] Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("289.......E6") to get test ads on this device
问题描述
使用 RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("289.......E6") 在此设备上获取测试广告.
我在 logcat 终端中收到了这条语句.使用 https://developers.google 中提供的测试广告实施 Google AdMob 时.com/admob/android/test-ads#enable_test_devices 在我的 Flutter 应用中.
I was getting this statement in the logcat terminal. When implementing the Google AdMob with the Test Ads provided in https://developers.google.com/admob/android/test-ads#enable_test_devices in my Flutter App.
推荐答案
解决方案
解决方法是使用testDeviceIds
String version;
List<String> testDeviceIds = ['289C....E6'];
void main() async {
WidgetsFlutterBinding.ensureInitialized();
timeDilation = 1;
PackageInfo packageInfo = await PackageInfo.fromPlatform();
version = packageInfo.version;
MobileAds.instance.initialize();
// thing to add
RequestConfiguration configuration =
RequestConfiguration(testDeviceIds: testDeviceIds);
MobileAds.instance.updateRequestConfiguration(configuration);
await Firebase.initializeApp();
runApp(MyApp());
}
如何获取TestDeviceID
如果您想在开发过程中测试应用中的广告.
How to get TestDeviceIDs
If you want to test ads in your app as you're developing.
- 加载您的广告集成应用并发出广告请求.
- 检查 logcat 输出是否有如下消息,其中显示了您的设备 ID 以及如何将其添加为测试设备:
使用 RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("289.......E6") 在此设备上获取测试广告.
- 在终端中添加你的 logcat 给你的设备 ID,并将其用作 testDeviceId
这篇关于使用 RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("289.......E6") 在此设备上获取测试广告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!