Using android MAC address as unique identifier

ぃ、小莉子 提交于 2019-12-04 13:47:26
CommonsWare

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.

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 !

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