Using android MAC address as unique identifier

我是研究僧i 提交于 2019-12-21 20:54:08

问题


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])?

FYI:

My app requires network so devices without networks won't be able to install it.


回答1:


But could I not use the MAC address of the device as a unique id?

Not 100% reliably.

If not, why not?

Here is what Google has to say on the subject:

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.

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

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])?

See this answer.




回答2:


MAC is unique, but can be spoofed by the user to any value, which would make it very insecure. If that's not a problem, you're probably good to go !



来源:https://stackoverflow.com/questions/17435538/using-android-mac-address-as-unique-identifier

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!