public void Bind(IBeaconConsumer ibeaconconsumer) { beaconMgr = IBeaconManager.GetInstanceForApplication((Context)ibeaconconsumer); beaconMgr.Bind(ibeaconconsumer); monitorNotifier = new MonitorNotifier(); monitorNotifier.EnterRegionComplete += EnteredRegionHandler; monitorNotifier.ExitRegionComplete += ExitedRegionHandler; rangeNotifier = new RangeNotifier(); rangeNotifier.DidRangeBeaconsInRegionComplete += EnteredRangeHandler; }
// // Handle any pending start/stop requests public void OnIBeaconServiceConnect(IBeaconConsumer consumer) { // become the listener IBeaconManager.SetMonitorNotifier(this); IBeaconManager.SetRangeNotifier(this); // protect against multiple calls if (IBeaconManagerBound == false) { IBeaconManagerBound = true; //Start Monitoring foreach (BeaconRegion region in PendingStartMonitor) { StartMonitoring(region); } //Stop Monitoring foreach (BeaconRegion region in PendingStopMonitor) { StopMonitoring(region); } //Start Ranging foreach (BeaconRegion region in PendingStartRanging) { StartRangingBeacons(region); } //Stop Ranging foreach (BeaconRegion region in PendingStopRanging) { StopRangingBeacons(region); } // clear lists PendingStartMonitor.Clear( ); PendingStopMonitor.Clear( ); PendingStartRanging.Clear( ); PendingStopRanging.Clear( ); } }