user6264
user6264

Reputation: 185

beacon distance in feet

How I can get the distance of a beacon in feet.can any one help me.This code gives me distance in meters

                        int b = Math.round(range);
                        int rssi1=rssi;
                        int txpower=-59;
                        Double distance=getDistance(rssi1,txpower);
                        int a = (int) (distance + 0.5);

Upvotes: 0

Views: 261

Answers (3)

iOS_MIB
iOS_MIB

Reputation: 1895

Just convert meter into feet...

1m = 3.280839895ft

distanceInFeet = distanceInMeter * 3.2808

Hope this will help you :)

Upvotes: 2

Priya Singhal
Priya Singhal

Reputation: 1291

// 1 metre = 3.28084 feet

                    int b = Math.round(range);
                    int rssi1=rssi;
                    int txpower=-59;
                    Double distance=getDistance(rssi1,txpower);
                    int a = (int) (distance + 0.5);
                    float feet = a*(3.28) ;

Upvotes: 0

Krunal Kapadiya
Krunal Kapadiya

Reputation: 3073

You can copy this code in your java file. and can get a distance in feet as,

double distanceInFeet = meterToFeet(distance);


public double meterToFeet(int distanceInMeter) {
    // as 1 meter = 3.28084 feet we have.  
    return 3.28084 * distanceInMeter;
}

Upvotes: 1

Related Questions