corona-warn-app / cwa-app-android

Native Android app using the Apple/Google exposure notification API. The CWA development ends on May 31, 2023. You still can warn other users until April 30, 2023. More information:
https://coronawarn.app/en/faq/#ramp_down
Apache License 2.0
2.44k stars 495 forks source link

Poor distance accuracy on Android #523

Closed mtbsteve closed 4 years ago

mtbsteve commented 4 years ago

Describe the bug

I tested the Android and iOS app with the beacon scanner of David Young http://www.davidgyoungtech.com/2020/04/24/hacking-with-contact-tracing-beacons

While the distance readings with my iPhone X are amazingly accurate at about +/- 30 centimetres, the results for a OnePlus A5010 are out of range. Readings were off about 3-5 meters.

Expected behaviour

At least an accuracy within a meter distance.

Steps to reproduce the issue

see screenshots Test setup: https://1drv.ms/u/s!AnKeW8KMoCcyyl9nsePdpaqpTSXU?e=8eKGhQ The device running the beacon scanner was at the same position as the photographer.

Test results: https://1drv.ms/u/s!AnKeW8KMoCcyymCv97la8HuPWDhG?e=kRbAMz

Technical details

iOS 13.5 Android 10

Possible Fix

Additional context

corneliusroemer commented 4 years ago

This cannot be fixed by the app itself. I advise to close. Out of scope.

Edit: @mtbsteve is raising a good point about reliability in general, but it's not something the app can deal with.

mtbsteve commented 4 years ago

Sorry, this cannot be closed w/o an official statement from the responsible developer. If this accuracy is the case on Android in general, the app becomes meaningless.

I continued testing on iOS devices, and can confirm that the distance measurement on iOS devices is close to perfect.

Would be great if someone else could test this with other Android phones to verify if my OnePlus is maybe faulty or if this is a generic problem with the plethora of Android devices.

jomapp commented 4 years ago

Works perfectly for me on my OnePlus 6T. So this might be an issue with your Android Device.

rawern commented 4 years ago

the accuracy of bluetooth attenuation in general is bad. it depends on so many variables. officials said they tested the concept under laboratory conditions, but these are not the same conditions where the app and smartphones are used. I had recently pointed out this issue here: https://github.com/corona-warn-app/cwa-documentation/issues/85 See the comment from @SebastianWolf-SAP at the end. An app can't overcome this general issue. The devs are aware and this problem is "out-of-scope for this project".

mtbsteve commented 4 years ago

@rawern @SebastianWolf-SAP thanks for cross referencing the issue. I understand the problem with the BT based distance measurement, but apparently it can be solved in a reasonable manner as my test results indicate on iOS.

The app I use for testing is based on the Android beacon lib https://github.com/AltBeacon/android-beacon-library which I assume is also used in one form or the other in the official Google Covid API implementation (correct me if I am wrong).

So what would be helpful at least is to publish a list of "tested" Android devices where the distance readings are in ballpark accurate - lets say +/- one meter under pre-defined conditions. In cases as with my tested Android device, the app is not so useful because it would not track an infected person even if I literally hugged them ;-)

egandro commented 4 years ago

If this accuracy is the case on Android in general, the app becomes meaningless.

Well :) knowing about issues like this - I asked for a "whitelist" for working phones.

https://github.com/corona-warn-app/cwa-documentation/issues/198

Cheap Phones are designed to be cheap. That's why the Bluetooth stack is tested with headphones and ear pads. The Bluetooth LE fancy stuff - like iBeacons or Watches often have problems. Good luck with blacklisting devices - while we don't even have a whitelist...

spacesynth commented 4 years ago

Got nothing to do with cheap versus expensive BT hardware.. most of it is antenna design, orientation of the antenna and objects: https://www.youtube.com/watch?v=SAi24ctpyZQ

Bluetooth Distance Estimates 101: http://www.davidgyoungtech.com/2020/05/15/how-far-can-you-go

Improving BLE Beacon Proximity Estimation Accuracy through Bayesian Filtering: https://arxiv.org/abs/2001.02396

Any distance is relevant, check the YouTube video to see how much of a difference it makes already if you wear your phone front or back pocket.

Edit: My current strategy is to use two phones in different pockets. If I get an alert I will tell if both got it or only one.

grigorig commented 4 years ago

Ranging via RSSI is an inherently flawed technology. There's not much you can do. Even though it is flawed, it is the best technology for contact tracing that is widely available and cheap.

BudickDa commented 4 years ago

I am testing it right now between a Pixel 3 and a Pixel 3a. Both smartphones are within 1 m. But measured distance is between 2 m and 9 m (rotation of the phones is a big factor).

Did you test distance measurements with smartphones that are in use (someone is watching a video horizontal, writing a message, has smartphone in different kind of pockets)?

tkowark commented 4 years ago

As mentioned before, this is not an issue that the app itself can fix. Fraunhofer institute is heavily involved in testing this.

Additionally, as mentioned in this issue RSSI alone is not a good measure for distance but transmission power needs to be considered, as well, when comparing different devices (though this does, of course, not solve the front/back pocket issue)

pdehaye commented 4 years ago

@mtbsteve is the offset at least constant at a given distance? can you calculate the offset as a function of distance? can you find your phone (or similar) in this list, used to configure the French app? This might indicate an error in the signal strength communicated by your phone.

mtbsteve commented 4 years ago

@pdehaye no I don’t own any of the Android phones listed in the code you were referencing.

I tested with some other phones in the meantime and found a more accurate distance measurements compared to my OnePlus A5010 I originally used. Results are still off compared to my iPhones, but at least in reasonable ballpark.

Another observation is that the ID transmission frequency is a factor of 3 higher on iOS compared with the Android app. This results in a better accuracy when both the sending and receiving devices are moving. Maybe this is something to look at. @tkowark