问题描述
使用 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_EMULATORrefers to the old legacy admob andcom.google.android.gms.ads.AdRequest.DEVICE_ID_EMULATORis 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设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)