Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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 !

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top