简体   繁体   English

如何获得唯一的 Android 设备 ID?

[英]how get a unique Android device ID?

According to the policy, we must use this method to register the user根据政策,我们必须使用这种方法来注册用户

Therefore, using email or number to register a user is not a good way for us因此,使用email或号码注册用户对我们来说不是一个好方法

According to my studies, there are several ways to get a unique ID根据我的研究,有几种方法可以获得唯一 ID

But each has its own problems但每个人都有自己的问题

I need a method that does not require special access from the user我需要一种不需要用户特殊访问的方法

Using Android ID is a good method.使用 Android ID 是一个好方法。 The problem is that it can be changed on rooted phones问题是它可以在有根手机上更改

And this is very bad in terms of security, of course, in Android lower than 8而且这在安全性方面是非常糟糕的,当然在Android低于8

Is there a specific trick or method to solve this problem?是否有解决此问题的特定技巧或方法?

I also know an application that does not use Android ID or mac WIFI and Pseudo-Unique ID, but does get the information according to the user's device.我也知道一个应用程序不使用 Android ID 或 mac WIFI 和 Pseudo-Unique ID,但确实根据用户的设备获取信息。 Is there a way to know what method it uses?有没有办法知道它使用什么方法?

it's simple all you have to do is use the below code.这很简单,您所要做的就是使用下面的代码。 this method will return android id now all you have to do is add checks at your backend.此方法将返回 android id 现在您所要做的就是在后端添加检查。

val id =  Settings.Secure.getString(
          getContext()?.contentResolver,
          Settings.Secure.ANDROID_ID
          )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM