Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beacon Not Detected by AltBeacon Library #1196

Open
shazleenn opened this issue Jun 16, 2024 · 0 comments
Open

Beacon Not Detected by AltBeacon Library #1196

shazleenn opened this issue Jun 16, 2024 · 0 comments

Comments

@shazleenn
Copy link

I am experiencing an issue where my Estimote beacon is not being detected by the AltBeacon library in my Android application. The beacon is visible in third-party apps like Mobile Beaconer and BeaconScope but not in my app.

Steps to Reproduce:
Configure the Estimote beacon with the following settings:
Namespace ID: edd1ebeac04e5defa017
Instance ID: f1e83900106d
Advertising Interval: 300 ms
Transmit Power: Weak (-12 dBm)

Add the AltBeacon library to the Android project:
gradle

implementation 'org.altbeacon:android-beacon-library:2.19.5'

the relevant code :

private void startBeaconDetection() {
beaconManager = BeaconManager.getInstanceForApplication(this);

beaconManager.getBeaconParsers().clear();
beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("s:0-1=feaa,m:2-2=00,p:3-3:-41,i:4-13,i:14-19"));

beaconManager.setForegroundScanPeriod(5000L); // Scan for 5 seconds
beaconManager.setForegroundBetweenScanPeriod(0L); // No interval between scans
beaconManager.setBackgroundScanPeriod(5000L); // Scan for 5 seconds
beaconManager.setBackgroundBetweenScanPeriod(0L); // No interval between scans
beaconManager.setRegionStatePersistenceEnabled(false);

beaconManager.bind(this);

}

@OverRide
public void onBeaconServiceConnect() {
beaconManager.addRangeNotifier(new RangeNotifier() {
@OverRide
public void didRangeBeaconsInRegion(Collection beacons, Region region) {
if (beacons.size() > 0) {
for (Beacon beacon : beacons) {
String namespace = beacon.getId1().toString();
String instance = beacon.getId2().toString();
String beaconInfo = "Beacon detected: Namespace = " + namespace + ", Instance = " + instance + ", RSSI = " + beacon.getRssi();
Log.d(TAG, beaconInfo);
runOnUiThread(() -> beaconTextView.setText(beaconInfo));
}
} else {
runOnUiThread(() -> beaconTextView.setText("Searching..."));
}
}
});

try {
    Identifier namespaceId = Identifier.parse("edd1ebeac04e5defa017");
    Identifier instanceId = Identifier.parse("f1e83900106d");
    Region region = new Region("myRangingUniqueId", namespaceId, instanceId, null);
    beaconManager.startRangingBeacons(region);
} catch (Exception e) {
    Log.e(TAG, "Cannot start ranging", e);
}

}

logs:
2024-06-17 01:22:08.364 26990-26990 MainActivity com.example.ezklia D Ranging beacons in region: id1: null id2: null id3: null
2024-06-17 01:22:08.365 26990-26990 MainActivity com.example.ezklia D Beacons detected: 0
2024-06-17 01:22:08.369 26990-26990 MainActivity com.example.ezklia D No beacons detected

Environment:
Android Studio Version: 4.1
Android Device: Redmi Note 13 Pro 5G
AltBeacon Library Version: 2.19.2 (also tested with 2.18.1)
Beacon Firmware: Estimote OS 4.13.2

Additional Notes:
The beacon is visible in third-party applications like Mobile Beaconer and BeaconScope.
All necessary permissions have been granted, and Bluetooth is enabled on the device.
Any guidance or assistance to resolve this issue would be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant