如何以编程方式获得Admob的设备ID?方式、设备、Admob、ID

2023-09-09 22:06:50 作者:凤眸有你

我有多个设备,我可能会有更多,并且不希望由一个补充它们。有谁知道什么ID Admob的使用?

解决方案

 字符串援助= Settings.Secure.getString(的getContext()getContentResolver(),android_id。);

obj对象= NULL;
尝试 {
    ((消息摘要)(OBJ = MessageDigest.getInstance(MD5)))。更新(
                                   aid.getBytes(),0,aid.length());

    OBJ =的String.Format(%032X,新的对象[] {新的BigInteger(1,
                                   ((消息摘要)目标文件).digest())});
}赶上(抛出:NoSuchAlgorithmException localNoSuchAlgorithmException){
    物镜= aid.substring(0,32);
}
 

我希望这会帮助你;)

I have multiple devices, and I probably will have more, and do not want to add them one by one. Does anybody know what ID Admob uses?

解决方案 Android Go 终于来了,Google 想要靠它获取下一个 10 亿用户

String aid = Settings.Secure.getString(getContext().getContentResolver(), "android_id");

Object obj = null;
try {
    ((MessageDigest) (obj = MessageDigest.getInstance("MD5"))).update(
                                   aid.getBytes(), 0, aid.length());

    obj = String.format("%032X", new Object[] { new BigInteger(1,
                                   ((MessageDigest) obj).digest()) });
} catch (NoSuchAlgorithmException localNoSuchAlgorithmException) {
    obj = aid.substring(0, 32);
}

I hope this will help you ;)

 
精彩推荐
图片推荐