我有多个设备,我可能还会有更多,不想一一添加。有人知道 Admob 使用什么 ID 吗?
最佳答案
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);
}
希望对您有所帮助;)
关于android - 如何以编程方式获取 Admob 的设备 ID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5249965/