title: How to calculate more accurate distance between beacon and android device?
body: <p>I have tried to calculate distance from beacon to android device using RSSI and TxPower but fluctuation is very high. So how to get more stable distance ? I have tried with code snippet given below :   </p>
  
  <pre><code>  public  double calculateAccuracy(int txPower, double rssi) {
          if (rssi == 0) {
              return -1.0;
          }
          double ratio = rssi * 1.0 / txPower;
          if (ratio &lt; 1.0) {
              return Math.pow(ratio, 10);
          } else {
              double accuracy = (0.89976) * Math.pow(ratio, 7.7095) + 0.111;
              return accuracy;
          }
      }
  </code></pre>