Beacon not catch more the 10 meter distance in android

60 Views Asked by At

I have used @hkpuits/react-native-beacons-manager npm

I want to scan Beacon which has a long distance, this is working for IOS device but not in android

Please check my code,

  `const region = {
      identifier: "bookify",
      uuid: uuid,
    };
    // Tells the library to detect iBeacons
    Beacons.init();
    Beacons.detectIBeacons();
    // Start detecting all iBeacons in the nearby
    const scanBeaconAndroid = async () => {
      try {
         Beacons.setForegroundScanPeriod(1000);
         await Beacons.startMonitoringForRegion(region);
         await Beacons.startRangingBeaconsInRegion(region);
         console.log(`Beacons ranging started succesfully!`);
      } catch (err) {
        console.log(`Beacons ranging not started, error: ${err}`);
      }
    };
    scanBeaconAndroid();
    // Print a log of the detected iBeacons (1 per second)
    Beacons.BeaconsEventEmitter.addListener("beaconsDidRange", (data) => {
      eventCount1++;
      if (eventCount1 == 30) {
        eventCount1 = 0;
        beaconAction()
      }
     
    });
  }`
1

There are 1 best solutions below

1
davidgyoung On

It is unlikely that your code is causing the difference in detection distance. The more likely cause is hardware Bluetooth antenna variations on your Android device. Different phone models sometimes have significant variations in the distance they can transmit and receive.

To check this, install an off the shelf Beacon scanner/transmitter app like by BeaconScope and see if you get similar results. In this app, I have taken care to make sure the scanning and transmitting are using the highest range allowed by the Android hardware.