Let's say I want to make an android app that will be installed in 2 devices. I want to know when one device is more than 10 meters away from the other device. What type of technology will I use for that? (i.e. proximity cards, rfid, nfc, etc). And how should I go about implementing that in android, generally speaking? Thank you
2 Answers
there are few options.
You can use Bluetooth Low Energy API and scan devices like this. You also can add another device info as filter and it will scan only this device.
List<ScanFilter> filters = new ArrayList<> ();
filters.add(/*create your scan filter*/);
ScanSettings settings = new ScanSettings.Builder()
.setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY)
.build();
ScanCallback callback = new ScanCallback() {
@Override public void onBatchScanResults(List<ScanResult> results) {
// Do something with scan results
}
@Override public void onScanFailed(int errorCode) {
// Notify error code
}
@Override public void onScanResult(int callbackType, ScanResult result) {
// Do something with scan result
}
};
mBluetoothAdapter.getBluetoothLeScanner().startScan(filters, settings, callback);
Another option is to try Samsung Active 2 watches, which could scan for BLE and detect another ones. Now at Navigine we are working with them and they show pretty good results. However, you will need to write the code for Tizen OS. If you will have any questions, feel free to write us!

- 484
- 2
- 5
- 13
Bluetooth Low Energy (BLE) is likely the technology you are looking for. It is widely available on modern Android phones and should enable you to determine the distance at the range around 10 meters.
BLE has it's own characteristics and limitation. Basically the accuracy goes down as the distance between the 2 devices gets longer. And the signal fluctuates when there are people walking nearby. I found this article explained quite clearly.
You will need to write a beacon app that runs on phone A to transmit packets. Then another scanner app that runs on phone B to receive packets and estimate the distance from the signal strength (RSSI).
There are already apps for acting as scanner (e.g. https://play.google.com/store/apps/details?id=com.bridou_n.beaconscanner) and beacon (e.g. https://play.google.com/store/apps/details?id=net.alea.beaconsimulator). You may get a taste of it before writing your own.
As framework for implementation, I can think of several choices:
- Bluetooth LE scanner and advertiser API which is kind of lower level
- Nearby Messages API which is higher level
- Third party APIs, e.g. Android Beacon Library

- 1,595
- 2
- 11
- 30
-
As @Lacek says only BLE is an option as NFC/RFID in mobile phones is designed to a distance of about 4cm, so far too short a range. – Andrew Jun 17 '20 at 22:34