使用 TEST_EMULATOR 和 DEVICE_ID_EMULATOR 有什么区别?我想在我的手机上测试 admob 广告系统,NOT 在 PC 上的模拟器上.
AdRequest 广告 = 新 AdRequest.Builder()..addTestDevice(com.google.ads.AdRequest.TEST_EMULATOR)..addTestDevice("YOUR_HASHED_DEVICE_ID")..建造();AdRequest 广告 = 新 AdRequest.Builder()..addTestDevice(com.google.ads.AdRequest.DEVICE_ID_EMULATOR)..addTestDevice("YOUR_HASHED_DEVICE_ID")..建造();区别在于 com.google.ads.AdRequest.TEST_EMULATOR 指的是 old 旧版 admob 和 com.google.android.gms.ads.AdRequest.DEVICE_ID_EMULATOR 是 新 google play services 版本的 admob.这已经取代了旧的遗留 admob.显然,您现在应该只使用新的 admob,因为旧的 admob 已被弃用.
要在真实设备上测试 admob 广告,您需要获取移动设备 ID 哈希并将其放在此处:.addTestDevice("YOUR_HASHED_DEVICE_ID").Admob 在 logcat 中添加一个带有设备 id 的日志,看起来或多或少像这样:
<块引用>
05-20 20:27:20.888:I/Ads(32367):使用 AdRequest.Builder.addTestDevice("BANANANANANANANANANNANANANANANA") 在此设备上获取测试广告.
只需将其复制为 addTestDevice 方法中的参数即可.
What is the difference between using TEST_EMULATOR and DEVICE_ID_EMULATOR? I want to test the admob ad system on my mobile phones, NOT on an emulator on the PC.
AdRequest ad = new AdRequest.Builder().
.addTestDevice(com.google.ads.AdRequest.TEST_EMULATOR).
.addTestDevice("YOUR_HASHED_DEVICE_ID").
.build();
AdRequest ad = new AdRequest.Builder().
.addTestDevice(com.google.ads.AdRequest.DEVICE_ID_EMULATOR).
.addTestDevice("YOUR_HASHED_DEVICE_ID").
.build();
The difference is that com.google.ads.AdRequest.TEST_EMULATOR refers to the old legacy admob and com.google.android.gms.ads.AdRequest.DEVICE_ID_EMULATOR is the new google play services version of admob. This has replaced the old legacy admob. Obviously you should now only use the new admob as the old one is deprecated.
To test admob ads on a real device you need to get the mobile device id hash and put it here: .addTestDevice("YOUR_HASHED_DEVICE_ID").
Admob adds a log with the device id in the logcat that looks more or less like this:
05-20 20:27:20.888: I/Ads(32367): Use AdRequest.Builder.addTestDevice("BANANANAANANANANANANNANANANANANA") to get test ads on this device.
Just copy this as a parameter in the addTestDevice method.
这篇关于在手机上测试 Admob 时 DEVICE_ID_EMULATOR 和 TEST_EMULATOR 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何创建漩涡/漩涡效果?How to create whirlpool/vortex effect?(如何创建漩涡/漩涡效果?)
Android/Java - GoogleMaps FragmentActivity 上的自定义视图Android/Java - Custom View on GoogleMaps FragmentActivity isnt shown(Android/Java - GoogleMaps FragmentActivity 上的自定义视图未显示)
LibGdx 2 半屏“按钮"LibGdx 2 half screen quot;buttonsquot;(LibGdx 2 半屏“按钮)
libgdx 剪切图像libgdx Cutting an image(libgdx 剪切图像)
如何在启动 Android LibGDX 项目时修复 NoClassDefFounHow do I fix a NoClassDefFoundError while launching Android LibGDX Project?(如何在启动 Android LibGDX 项目时修复 NoClassDefFoundError?)
如何让玩家通过相机被摧毁?How to make player get destroyed through camera?(如何让玩家通过相机被摧毁?)