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.
Related
I'm working on a project where a central device connects to peripherals advertising a specific GATT service. The central device exchanges some information with the phone after which the connection is no longer needed and the device disconnects.
The problem that I'm running into is that the phone seems to change its MAC address after every new connection. So basically, every time I connect to a device it looks like a new device appears. So my central node tries to connect to the new service again. This is very annoying since I was thinking of using the MAC address to know that I had already connected to the device and did not need to do the information exchange again. Note that I know that the MAC address rotates every 30 minutes anyways and that's something I'm willing to deal with, connecting once every 30 minutes is fine, but the rotation on connection causes my device to chain connect to the phone that always appear like a new device.
A few ideas I have thought of to work around this:
Obtain the new MAC address from the phone and share it with the central device. That has 2 issues:
MAC Address is not accessible with the Android APIs except using sketchy reflection.
It would only work if a single central device is in Range, since only the last node would know the new MAC address to avoid.
Advertise service Data with a random ID that I would manually rotate every 30 minutes. This data could be in the same advertisement packet. That allows me to ID the device without compromising privacy.
It however might be very hard to implement on iOS that has very restrictive background advertisement APIs. iOS doesn't actually appear to have the same behavior though so it might be possible to implement a completely different method for iOS.
Disabling this "rotate MAC on connection" feature doesn't seem possible.
How can I work around this issue?
If you Bluetooth pair the devices, then the Android device will send over its IRK (Identity Resolving Key). With this you will be able to derive if a given Bluetooth Device Address was generated by the particular IRK or not. That way you can identify an Android device. It works the same if you replace Android with iOS.
See your Bluetooth stack's documentation how to deal with IRKs.
I have been doing a ton of research on this project I want to do, probably read every SO post (bluejacking, RFCOMM, beacons, etc...) and my head is spinning.
I want to create a system at home, using Arduino (with bluetooth le) that will scan bluetooth and detect when my phone or any of my family members phones are in proximity. Whether this is a MAC scanner or simply getting the friendly name. I would also like to get the RSSI. I dont need to do accurate distance measurement but I would like to know approximately how close they are. Does anybody have any suggestions for this approach? I know I can create an app on the phone and have it become a beacon and this may be an option but I am concerned with Android, it would have to be Marshmallow 5.0 at a minimum. I would like support to be a little lower than that, like JB or KK. So, it seems like there should be a simple scan, just looking for the MAC or name. That is all I really need.
That said, the main question I have is, can you scan for and see bluetooth devices in range if they are already paired to something? Like a Bluetooth headset? I understand bluetooth is point to point but does it allow multiple connections or at least broadcast the mac or name when paired?
This question, along with any general suggestions will help me out tremendously!
Thanks!
Bluetooth Discovery from the Listener involves Listening for Bluetooth Inquiry packets(RX) and inquiry response (TX).if done continuously this will deplete the battery. Hence most devices (including Mobile Phones and Headsets) has a policy of when to be discover-able and connectable. Headsets in particular are discoverable only when they are instructed and connectable until one device is connected to it ( There are probably exceptions where the headset has the capability to be connected to multiple phones at the same time). Most Mobile Phones are discoverable only when they are in settings screen ( Android,IOS and Windows Phones), but unlike the headset case they are connectable.
so one option with the MobilePhone is to see if it is possible to connect to them after pairing once ( for example by trying a service search on the remote device and see if it returns the service attributes, this internally makes a connection and indirectly ensures the presence of the device).
if you are specific about a mobile phone which is already paired then you might need to establish a higherlayer connection ( such as SPP) with Authentication and encryption. This would force a two way check between devices to see whether they are already paired. other less secure option is to rely on the Phone (Android and IOS phones doesn't generally Allow a higher layer connection without encryption/pairing) and try to establish an SPP connection to the phone.
Another option is to use Bluetooth-LowEnergy. But Note that security in BT was superior to BLE till BTv4.1 and same on BTv4.2.
This question follows on from Unity3D -- Send message to other mobile phones in the same vicinity
However, I made mistake of restricting to Unity3D.
So I would like to re-ask the question without that constraint.
Let us say we have 20 mobile phone users in a cave (so no Wi-Fi networks / isGPS)
One user hits a button, and every other user's screen flashes, (within a few milliseconds)
How to accomplish this?
What if everyone is using an iPhone?
What if there is a mix of iPhone and android users?
Finally, is there any solution that would cover a wider range of phones?
You should have some network so that mobiles can share some data. Bluetooth can have maximum of 10 m distance coverage (depends upon devices though). Since, all mobile are running same app they should be linked to a network and communicate. Please Check:
http://developer.android.com/samples/BluetoothLeGatt/index.html
You can create one device as server and communicate among other devices.
https://github.com/polyclef/BluetoothChatMulti
If you have installed the app on all of the devices then in all probability yes, if the device supports push (pretty much any smartphone) then you can use the push service to synchronize the devices based on geofencing (ie, 10m from my location), there are some other discovery routes you could try to (without using the B word) pinging other devices
the app would need to be able to provide some sort of server service if it was to create its own private network based on the IP addresses of the devices it found nearby, as those devices would have to connect to that phone acting as a server. the network interface shouldn't be important, but connecting the satellite devices to the server should be. You could try doing it based on which device can provide data services, aka hotspot. You can easily connect devices to networks programmatically.
at that point your faced with the classic client server problem. There is going to be a huge amount of work to get devices configured, network creation, client server infrastructure if it has to be done without data, packet optimization. Very expensive and very high risk depending on how many restrictions there are.
Search for How to make a html5 group chat and then build on that example.
Possibly send commands to the chat delimited by a / character where a javascript could then execute the command.
Good Luck with your design.
Danny117
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 !
I'm interested in fleshing out an idea for a Android phone app, and I'm wondering if this is possible. So I would have the app running in the background on Phone A, then when it finds another Android phone B, it saves certain information like time, GPS location, just state variables.
But if the other phone is also running the same app, the two phones connect and share trivial non-private information.
Hypothetically, would this be possible? Would I go through a local ad-hoc Wi-Fi connection, or constantly broadcast Bluetooth?
If both people have the same app, you could do it in a round about way. If two people installed the app on their phone and agreed to have their gps coordinates shared, you could upload both sets of gps coordinates to a server as the people move around. The server could then compare which people are close to each other. When the user wants to share information with another user, the phone just needs to ask the server who is in their vicinity and sharing could be done over the internet. This is essentially how Bump works. Bumping two phones together triggers a call to the server to see who else is bumping in that vicinity at the same time. After phones close by are discovered, you might be able to trigger bluetooth pairing and sharing if you don't want to share over the internet.
Bluetooth is the easiest way for two phones to communicate directly with each other. However, both phones would have to be paired through the Settings->Wireless->Bluetooth menu. You would experience better range and speed with WiFi, but this requires a router as far as I know.
I found out how this can be done, use the viewranger app on both phones, create a user and log into the app on both phones. I set this up with myself as the user. Then the second phone (the one with broken gps) is used to track the user who is in my back pocket.
The user in both cases is me.
The problem with this is that a phone signal is required.