本文介绍了android获取adMob的设备ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在Android设备上测试adMob,并遵循文档,我试图获取设备ID执行adRequest。但是,我无法在logCat中找到设备ID!我在做什么错?
I am testing adMob on my android device and following with documentation, I am trying to get device ID executing adRequest. However, I am not able to find device ID in the logCat! What I am doing wrong?
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
adRequest.addTestDevice("test");
编辑:这不是重复的,其他帖子的这些方法对我来说不起作用。 p>
it is not a duplicate, those methods from other post are not working for me.
推荐答案
final TelephonyManager tm =(TelephonyManager)getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);
String deviceid = tm.getDeviceId();
这篇关于android获取adMob的设备ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!