Exemplo n.º 1
0
 /**
  * Sets the duration in milliseconds of each Bluetooth LE scan cycle to look for beacons. default
  * 1.1s = 1100ms
  *
  * @param p (ms)
  */
 public void setForegroundScanPeriod(long p) {
   mBeaconManager.setForegroundScanPeriod(p);
   try {
     mBeaconManager.updateScanPeriods(); // 保证在下一个循环扫描周期生效
   } catch (RemoteException e) {
     LogManager.d(TAG, "RemoteException:" + e.toString());
   }
 }
Exemplo n.º 2
0
 @Override
 public void onCreate() {
   mAllBeaconsRegion = new Region("all beacons", null, null, null);
   mBeaconManager = BeaconManager.getInstanceForApplication(this);
   mBackgroundPowerSaver = new BackgroundPowerSaver(this);
   mRegionBootstrap = new RegionBootstrap(this, mAllBeaconsRegion);
   /* ibeacon layout */
   mBeaconManager.setForegroundScanPeriod(500);
   mBeaconManager
       .getBeaconParsers()
       .add(new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
 }