AltBeacon Lib can not detect beacons

PressRex profile image
by PressRex
AltBeacon Lib can not detect beacons

I have 2 beacons nearby, and the manufacturer indicates their UUID are all the same of:

beacon uuid: fda50693-a4e2-4fb1-afcf-c6eb07647825

by using the direct Android API, I can constantly(every seconds) see the beacon mac and scanRecord via:

ScanCallback leScanCallback =
    new ScanCallback() {
        @Override
        public void onScanResult(int callbackType, ScanResult result) {
            super.onScanResult(callbackType, result);
            // scanned result data bytes sample:onScanResult-> deviceName: R24110120, rssi: -52, 
            // deviceMacAddress: 52:0A:24:11:00:78, 
            //scanRecord: 0201061aff4c000215fda50693a4e24fb1afcfc6eb0764782500010002d80a0952323431313031323011160318520a24110078000100020603e864000000
        }
};
var bluetoothLeScanner = BluetoothAdapter.getDefaultAdapter().getBluetoothLeScanner();
var bluetoothLeScanner = BluetoothAdapter.getDefaultAdapter().getBluetoothLeScanner();
            ScanSettings settings = new ScanSettings.Builder().build();
            ScanFilter scanFilter = new ScanFilter.Builder().build();
            ArrayList<ScanFilter> scanFilters = new ArrayList<>();
            scanFilters.add(scanFilter);
            bluetoothLeScanner.startScan(scanFilters, settings, leScanCallback);

while if I choose the library for scanning:

beaconManager = BeaconManager.getInstanceForApplication(this);
// To detect proprietary beacons, you must add a line like below corresponding to yo
// type.  Do a web search for "setBeaconLayout" to get the proper expression.
beaconManager.getBeaconParsers().add(new BeaconParser().
        setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
beaconManager.addMonitorNotifier(new MonitorNotifier() {
    @Override
    public void didEnterRegion(Region region) {
        var regionLogStr = String.format("didEnterRegion: %s", region.toString());
        Log.i(TAG, "onScanResult - I just saw an beacon for the first time! - " + re
    }
    @Override
    public void didExitRegion(Region region) {
        Log.i(TAG, "onScanResult - I no longer see an beacon");
    }
    @Override
    public void didDetermineStateForRegion(int state, Region region) {
        var regionLogStr = String.format("didDetermineStateForRegion: %s, mac: %s", region.toString(), region.getBluetoothAddress());
        Log.i(TAG, "onScanResult - I have just switched from seeing/not seeing beacons: " + state + " - " + regionLogStr);
    }
});
beaconManager.startMonitoring(new Region("myMonitoringUniqueId", null, null, null));

I could never have any of that callback: didEnterRegion hit, only the didDetermineStateForRegion get called when app just started with logging:

onScanResult - I have just switched from seeing/not seeing beacons: 0 - didDetermineStateForRegion: id1: null id2: null id3: null, mac: null

what could be wrong here?

Source: View source

PressRex profile image
by PressRex

Subscribe to New Posts

Lorem ultrices malesuada sapien amet pulvinar quis. Feugiat etiam ullamcorper pharetra vitae nibh enim vel.

Success! Now Check Your Email

To complete Subscribe, click the confirmation link in your inbox. If it doesn’t arrive within 3 minutes, check your spam folder.

Ok, Thanks

Read More