Last active
October 26, 2022 17:40
-
-
Save JoostKiens/d834d8acd3a6c78324c9 to your computer and use it in GitHub Desktop.
iBeacon calculate distance in meters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on http://stackoverflow.com/a/20434019 | |
function calculateAccuracy(txPower, rssi) { | |
if (rssi === 0) { | |
return -1; // if we cannot determine accuracy, return -1. | |
} | |
var ratio = rssi * 1 / txPower; | |
if (ratio < 1.0) { | |
return Math.pow(ratio, 10); | |
} else { | |
return (0.89976) * Math.pow(ratio, 7.7095) + 0.111; | |
} | |
} |
This formula for iOS devices ? How is for android ?
This formula for iOS devices ? How is for android ?
@hadpro24 sorry I have no idea, I have used this function once in 2015 and have forgotten the context 🤷♂️
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@navyseai
please reference it
https://stackoverflow.com/questions/20416218/understanding-ibeacon-distancing