A
A
Artem2013-08-13 14:47:52
Android
Artem, 2013-08-13 14:47:52

How to detect a user next to you?

Let's say my application is installed on many devices. Is it possible to programmatically catch the moment when any two of these devices are at a distance of several meters from each other?
In principle, now almost every device has bluetooth and Wi-Fi. There are two questions here:
1. Is it possible to implement this via bluetooth? In which direction to dig, if this is feasible? In principle, these devices can be pre-loaded with some data that is necessary for the connection.
2. As far as I know, Android does not have the ability to connect peer-to-peer, and the ability to access point mode appeared only in version 4.0 and higher (I would like not to cut off old devices). Maybe there is some other approach?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
C
cat_crash, 2013-08-13
@cat_crash

Try with GPS and your own server-side. You send the coordinates of everyone who has the application, and on the server you look at which of them is at what distance from each other

J
jimpanzer, 2013-08-13
@jimpanzer

Alternatively, you can rely on whether the devices are in the same wifi network. Get the BSSID of all networks that the devices see and go.

A
anmipo, 2013-08-13
@anmipo

In the forest / field, you can compare the GPS coordinates of phones. Plus - good accuracy, cons - power consumption and delay during a cold start of GPS, you need an Internet connection to the server, the difficulty of working in a moving vehicle.
In the office, you can compare lists of available Wi-Fi networks. If both phones see the same access points (with an error for the weakest / farthest), and there are a lot of them - most likely, the phones are not far from each other. Plus - fast, cons - false positive and false negative errors are possible, you need an Internet connection to the server.
In a quiet basement without GPS, Wi-Fi and the Internet - you can exchange audio signals. One phone is beeping, the other is listening. Pros - fast, no internet required; cons - extra noise, false negative errors (“didn’t hear”). You can beep either on a schedule, or just so that one phone calls another :)
In other places - Bluetooth: some devices make themselves discoverable, others scan for available Bluetooth devices nearby. Pros - good accuracy, cons - power consumption during frequent checks, delay in scanning (in older versions of Bluetooth, about 10 seconds, I don’t know about new ones).

G
GavriKos, 2013-08-13
@GavriKos

a few meters is to look only towards the bluetooth, according to the list of devices available around. GPS - inaccurate + does not catch everywhere. WiFi cannot be relied upon + forest conditions, getCellLocation() - radius too large

A
asidorov, 2014-05-13
@asidorov

If still relevant, then here: https://itunes.apple.com/ru/app/mee2/id770196787?mt=8

A
Andrey Tsaplin, 2018-02-06
@Lolman

As far as I understand, this is not about a peer-to-peer connection, but about the fact of discovery. Within the same platform, you can use Bluetooth for Android-to-Android discovery and BLE for iOS-to-iOS. You need to write some unique token in the "device name" and find it on another. With cross-platform discovery, things are more complicated.
I advise you to read an article on this topic: https://habrahabr.ru/post/347954/. It discusses in detail all the ways to solve this problem with their pros and cons.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question