1

I my case I am trying to act my device as beacon and tried to set the txpower I want my beacon to get disappear from Locate App whenever I am out of its range so I tried setting the txpower distance for 1 meter but even after I go out of range of my beacon let's say 3-4 meter I still see my beacon on Locate App even though I have set it for 1 meter because it has rssi power which always varies which actually does the signal transmission part, I tried setting hardcode rssi power but still after seeing the beacon on Locate App it varies and when I am at distance of 3-4 meter I am able to see my beacon on Locate App.

Below is my code where I am trying to set my beacon.

Beacon beacon = new Beacon.Builder()
            .setId1("2f234454-cf6d-4a0f-adf2-f4911ba9ffa6")
            .setId2(String.valueOf(major))
            .setId3(String.valueOf(minor))
            .setManufacturer(0x004C)
            .setTxPower(-84)
            .setRssi(-49)
            .setDataFields(Arrays.asList(new Long[]{0l}))
            .build();


    BeaconParser beaconParser = new BeaconParser()
            .setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24");//

    beaconTransmitter = new BeaconTransmitter(this, beaconParser);
    beaconTransmitter.startAdvertising(beacon, new AdvertiseCallback() {

        @Override
        public void onStartFailure(int errorCode) {
            Log.e("Class", "Advertisement start failed with code: " + errorCode);
        }

        @Override
        public void onStartSuccess(AdvertiseSettings settingsInEffect) {
            Log.i("class", "Advertisement start succeeded."+settingsInEffect.getTxPowerLevel());
            Log.i("class", "Advertisement start succeeded."+settingsInEffect);
        }
    });
bad_coder
  • 11,289
  • 20
  • 44
  • 72

1 Answers1

0

You need to calibrate your transmission power such that the BLE signal does not transmit further than a metre (or whatever your limit is). Different devices have different hardware with different behaviour so there is no exact transmission power which will transmit in a 1 m range if it was set for any BLE device. Also, the RSSI is a measured value which must vary as the distance between the transmitter and receiver is varied. The RSSI value that is set is a value used by other devices that sense the beacon, to calibrate the calculations those devices do which involve the beacon. For example, you could set the RSSI to a value which is the approximate measured RSSI when the beacon is 1 m away from the receiver. This could assist with the calculation of distance from the beacon when sensing the beacon with different receivers.