使用Android MAC地址作为唯一标识符 [英] Using android MAC address as unique identifier
问题描述
我在这里读过很多关于stackoverflow的文章,内容是关于android没有唯一标识符的.但是我不能使用设备的MAC地址作为唯一ID吗?如果没有,为什么不呢?如果是,是否有人知道如何以编程方式获取它(即一段代码[请])?
I have been reading a number of posts here on stackoverflow about android not having unique identifiers. But could I not use the MAC address of the device as a unique id? If not, why not? If yes, does anyone know how to get it programmatically (i.e. a piece of code [please])?
仅供参考:
我的应用需要网络连接,因此没有网络的设备将无法安装它.
My app requires network so devices without networks won't be able to install it.
推荐答案
但是我不能使用设备的MAC地址作为唯一ID吗?
But could I not use the MAC address of the device as a unique id?
不是100%可靠.
如果没有,为什么不呢?
If not, why not?
可能可以从设备的WiFi或蓝牙硬件中检索Mac地址.我们不建议将其用作唯一标识符.首先,并非所有设备都具有WiFi.另外,如果未打开WiFi,则硬件可能不会报告Mac地址.
It may be possible to retrieve a Mac address from a device’s WiFi or Bluetooth hardware. We do not recommend using this as a unique identifier. To start with, not all devices have WiFi. Also, if the WiFi is not turned on, the hardware may not report the Mac address.
此外,您假设所有设备都将通过一种或另一种方式准确地报告MAC地址.我会假设自定义ROM(甚至是植根设备)可能会欺骗MAC地址.这可能对您来说无关紧要-我只是指出来.
Also, you are assuming that all devices will accurately report the MAC address by one means or another. I would assume that custom ROMs, and perhaps rooted devices, might be able to spoof the MAC address. This may or may not be a concern for you -- I'm just pointing it out.
我的应用需要网络
My app requires network
充其量,它可能需要WiFi.它不需要打开WiFi.
At best, it can require WiFi. It cannot require that WiFi is turned on.
有人知道如何以编程方式获取它(即一段代码[请])?
does anyone know how to get it programmatically (i.e. a piece of code [please])?
请参见此答案.
这篇关于使用Android MAC地址作为唯一标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!