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.
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 !
Related
In Android 5.0, BLE doesn't use static MAC addresses anymore, but the MACs change after intervals, using a method called IRK and public key cryptography.
Is it possible to uniquely identify an Android phone in a way that can not be spoofed by the user of that phone, or has that become completely impossible now unless the other side co-operates?
No, it is not possible. That's the whole idea of using IRKs: only bonded devices can identify it after the address changes. For those who do not possess the IRK (because they have not bonded), it would always appear as a completely new device (hence the privacy).
The private address is generated using the devices IRK exchanged during the previous pairing/bonding procedure. So if they have not bonded, you can't get irk.
I'm thinking to have a third party to promo my app, and I'll pay them per install. In order to avoid fraud, I need to have a unique ID stored in my database. My problem here is that I can't find a reliable unique ID.
IMEI - only works on phone
Android ID - can be changed even not a rooted device
WLAN MAC - not all devices have wifi, or the device has wifi turned off.
Bluetooth MAC - same as above
I know device with root access can easily change the IDs, but let's not worry about it now. I assume no one has a rooted device. How do I get a unique ID???
Please help. Thanks
Try looking into OpenUDID for Android, there doesn't seem to be a better way to do what you want for the time being:
https://github.com/vieux/OpenUDID
I wanted to know how I could return the MAC addresses connected to a router so I could get a count of how many users are connected to a specific AP? I've been doing research on this but I haven't found too much help. The one thing I did find is that you can get this information from parsing the /proc/net/arp file, however, from my understanding for this to work your phone must be acting as an AP itself. I am trying to write an Android app that is able to return the number of users on a specific router. This is part of a project for school. The app is just for learning purposes since I will be using it to scan routers that are not my own.
You have your answer if your Android is the AP. But if the AP is a router outside your own device and control this will mean connecting via a admin API to get at the router's information. As far as I know there are no standards for this kind of API so might be stuck doing interfaces to a few major manufacturers and models via whatever methods they may offer, if any. And don't forget that you will still need admin access (admin user id/password) to the router.
An SO Q/A on a similar topic
I have a WiFi network with several mobile devices/smartphones (e.g.: iPhone, Samsung). I know their IP addresses, but wish to identify them programatically from my PC without installing any app on them (e.g.: "noldS2" - "GT 9100" - "Android 2.3.5" .. friendly name - device name - os)
There were various methods described on the internet, but ActiveSync seems to be the best. I've investigated and attempted to connect to the devices using OpenNETCF, RAPI [...] without luck. (I've also investigated other methods like port scans which seem less accurate.)
How could I use ActiveSync to programatically identify the mobile devices connected to WiFi from my PC without needing special apps or permissions from them?
Presumably you're going down this path because ActiveSync clients must pass the server a Device ID string during their session handshake, I don't see any way to accomplish that because that conversation will always occur over HTTPS and will therefore be protected from snooping. Even if you could get the device ID it won't tell you the operating system version or anything like that.
I think you'll have to use another technique, and I'm not sure what that might be.
Every mobile device connected to ActiveSync should store quite some information: http://msdn.microsoft.com/en-us/library/ee202944(v=exchg.80).aspx including: http://msdn.microsoft.com/en-us/library/gg675629(v=exchg.80).aspx
As mentioned by #brian-kelly you should be able to get the needed information from the devices HTTP request user-agent string. Put your PC's wifi card in promiscuous mode and process the collected data.
I want to track people (carrying mobile devices) in a pedestrian street by using two "check points" A and B.
I'm planning to place mobile devices or netbooks with Android/IOS or Linux in each check point and log an id so I can tell how many walked from A to B. I know I can discover other peoples devices using bluetooth but can it be done with wifi? I thinking of turning my devices into wifi access points. People will of course not connect to the access point, just walk by.
So my question is: Can it be done on the mentioned platforms? It is important that I can tell if the same person passed both A and B by logging a "device id" i.e. the MAC address.
You should be able to do this, but only for devices which have WiFi switched on, and are actively seeking WiFi hotspots, which may be relatively few of the devices which actual pass by. The MAC address of each device will be unique, and you can use this to map the same device between your two points.
Regards,
Mark
I found Kismet, which can do what I want. But its *unix only, so I'm planning to use small "netbooks" instead of mobile devices. I've also tested Ubertooth One, which can detect all Bluetooth devices by sniffing lap addresses.