Open Miteshmakwana73 opened 3 years ago
i am trying to get distance but not getting accurate result every time.
if i place beacon and mobile in stable place it's changing distance value how can i avoid that.
this is my code for get distance
fun calcDistbyRSSI(rssi: Int, measurePower: Int = -59): String? { val iRssi = Math.abs(rssi) val iMeasurePower = Math.abs(measurePower) val power:Double = (iRssi - iMeasurePower)/(10*2.0) // ft = m * 3.2808 if (Math.pow(10.0,power) * 3.2808 < 1.0){ return String.format("%.2f ft(Immediate)", Math.pow(10.0,power) * 3.2808) }else if (Math.pow(10.0,power) * 3.2808 > 1.0 && Math.pow(10.0,power) * 3.2808 < 10.0){ return String.format("%.2f ft(Near)", Math.pow(10.0,power) * 3.2808) }else{ return String.format("%.2f ft(Far)", Math.pow(10.0,power) * 3.2808) } }
i am trying to get distance but not getting accurate result every time.
if i place beacon and mobile in stable place it's changing distance value how can i avoid that.
this is my code for get distance