2

I have used the Alt-Beacon reference application as a starting point on how to implement bootstrap regions. The application restarts if killed but the beacon format is always being set to Alt-Beacon and not iBeacon.

Logcat on startup:

D/BeaconParser: Parsing beacon layout: m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25

Bootstrap code:

beaconManager = org.altbeacon.beacon.BeaconManager.getInstanceForApplication(this);
beaconManager.getBeaconParsers().clear();

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

beaconManager.setBackgroundBetweenScanPeriod(5000l);
beaconManager.setBackgroundScanPeriod(1000l);
beaconManager.setRegionStatePersistenceEnabled(false);

Region region = new Region("backgroundRegion",null, null, null);

regionBootstrap = new RegionBootstrap(this, region);
BackgroundPowerSaver backgroundPowerSaver = new     BackgroundPowerSaver(this);

I would expect that when the app was restarted I should see:

m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24

I am using 2.15.2 of AltBeacon in Android Studio 3.1.3 with test device of Samsung S5 Mini running Android 6.0.1

Further information: When the phone is rebooted and the USB connected I would expect to see the app start and listen for iBeacon packets. It appears to restart but is killed by the OS.

Logcat:

12-07 17:32:08.132 8359-8359/net.simplesdktest I/InstantRun: starting instant run server: is main process

12-07 17:32:08.212 8359-8359/net.simplesdktest I/BeaconManager: BeaconManager started up on pid 8359 named 'net.simplesdktest' for application package 'net.simplesdktest'. isMainProcess=true

12-07 17:32:08.357 4889-4889/? I/TaskManager:PackageInfo: getRunningAppProcesses() - proc:net.simplesdktest, pkg:net.simplesdktest, uid:10346, pid:8359

12-07 17:32:12.822 2390-3458/? I/ActivityManager: Killing 8359:net.simplesdktest/u0a346 (adj 15): DHA:empty #21

newbie101
  • 163
  • 1
  • 1
  • 10

2 Answers2

1
setBeaconLayout("m:0-3=4c000215,i:4-19,i:20-21,i:22-23,p:24-24"));

This one detects ibeacon format BLE beacons doesn't it?

Source

pb772
  • 539
  • 1
  • 3
  • 14
  • 1
    As that source link suggest you do not need to specify the first 2 bytes ie. m:0-3 you can just use m:2-3. – newbie101 Dec 07 '18 at 04:54
0

It appears that when the beacon manager is first created it adds the AltBeacon format by default. I have managed to clear this out and set iBeacon which is now being detected.

newbie101
  • 163
  • 1
  • 1
  • 10