public BeaconService() { _mainActivity = MainActivity.Instance; _monitorNotifier = new MonitorNotifier(); _rangeNotifier = new RangeNotifier(); _dictionaryOfBeaconData = new Dictionary <string, BeaconDataModel>(); /* * _beaconManager.SetForegroundScanPeriod(BEACONS_UPDATES_IN_MILLISECONDS); * _beaconManager.SetForegroundBetweenScanPeriod(BEACONS_UPDATES_IN_MILLISECONDS); * * _beaconManager.SetBackgroundScanPeriod(BEACONS_UPDATES_IN_MILLISECONDS); * _beaconManager.SetBackgroundBetweenScanPeriod(BEACONS_UPDATES_IN_MILLISECONDS); * * _beaconManager.UpdateScanPeriods(); * * // MonitorNotifier * _monitorNotifier.DetermineStateForRegionComplete += DetermineStateForRegionComplete; * _monitorNotifier.EnterRegionComplete += EnterRegionComplete; * _monitorNotifier.ExitRegionComplete += ExitRegionComplete; * _beaconManager.AddMonitorNotifier(_monitorNotifier); * * // RangeNotifier * _rangeNotifier.DidRangeBeaconsInRegionComplete += DidRangeBeaconsInRegionComplete; * _beaconManager.AddRangeNotifier(_rangeNotifier); * * _fieldRegion = new AltBeaconOrg.BoundBeacon.Region(AppConstants.AppUUID, null, null, null); */ }
private BeaconManager InitializeBeaconManager() { RequestPermission(); // Enable the BeaconManager _beaconManager = BeaconManager.GetInstanceForApplication(_mainActivity); /* #region Set up Beacon Simulator for TEST USE * // Beacon Simulator * var beaconSimulator = new BeaconSimulator(); * beaconSimulator.CreateBasicSimulatedBeacons(); * BeaconManager.BeaconSimulator = beaconSimulator; * // Beacon Simulator #endregion Set up Beacon Simulator for TEST USE */ _monitorNotifier = new MonitorNotifier(); _rangeNotifier = new RangeNotifier(); //iBeacon BeaconParser beaconParser = new BeaconParser().SetBeaconLayout(AppConstants.iBeaconFormat); _beaconManager.BeaconParsers.Add(beaconParser); // BeaconManager Setting // Check Touch おそらくmain activity beacon consumer側で設定 /* * _beaconManager.SetForegroundScanPeriod(AppConstants.BEACONS_UPDATES_IN_MILLISECONDS); * _beaconManager.SetForegroundBetweenScanPeriod(AppConstants.BEACONS_UPDATES_IN_MILLISECONDS); * _beaconManager.SetBackgroundScanPeriod(AppConstants.BEACONS_UPDATES_IN_MILLISECONDS); * _beaconManager.SetBackgroundBetweenScanPeriod(AppConstants.BEACONS_UPDATES_IN_MILLISECONDS); * _beaconManager.UpdateScanPeriods(); */ // MonitorNotifier _monitorNotifier.DetermineStateForRegionComplete += DetermineStateForRegionComplete; _monitorNotifier.EnterRegionComplete += EnterRegionComplete; _monitorNotifier.ExitRegionComplete += ExitRegionComplete; _beaconManager.AddMonitorNotifier(_monitorNotifier); // RangeNotifier _rangeNotifier.DidRangeBeaconsInRegionComplete += DidRangeBeaconsInRegionComplete; _beaconManager.AddRangeNotifier(_rangeNotifier); _fieldRegion = new AltBeaconOrg.BoundBeacon.Region("AppAppApp", Identifier.Parse(AppConstants.iBeaconAppUuid), null, null); _beaconManager.Bind(_mainActivity); return(_beaconManager); }
private BeaconManager InitializeBeaconManager() { // Enable the BeaconManager _beaconManager = BeaconManager.GetInstanceForApplication(_mainActivity); #region Set up Beacon Simulator for TEST USE // Beacon Simulator var beaconSimulator = new BeaconSimulator(); beaconSimulator.CreateBasicSimulatedBeacons(); BeaconManager.BeaconSimulator = beaconSimulator; // Beacon Simulator #endregion Set up Beacon Simulator for TEST USE _monitorNotifier = new MonitorNotifier(); _rangeNotifier = new RangeNotifier(); _dictionaryOfBeaconData = new Dictionary <string, BeaconDataModel>(); //iBeacon BeaconParser beaconParser = new BeaconParser().SetBeaconLayout(AppConstants.IBEACON_FORMAT); _beaconManager.BeaconParsers.Add(beaconParser); // BeaconManager Setting /* * _beaconManager.SetForegroundScanPeriod(AppConstants.BEACONS_UPDATES_IN_MILLISECONDS); * _beaconManager.SetForegroundBetweenScanPeriod(AppConstants.BEACONS_UPDATES_IN_MILLISECONDS); * _beaconManager.SetBackgroundScanPeriod(AppConstants.BEACONS_UPDATES_IN_MILLISECONDS); * _beaconManager.SetBackgroundBetweenScanPeriod(AppConstants.BEACONS_UPDATES_IN_MILLISECONDS); * _beaconManager.UpdateScanPeriods(); */ // MonitorNotifier _monitorNotifier.DetermineStateForRegionComplete += DetermineStateForRegionComplete; _monitorNotifier.EnterRegionComplete += EnterRegionComplete; _monitorNotifier.ExitRegionComplete += ExitRegionComplete; _beaconManager.AddMonitorNotifier(_monitorNotifier); // RangeNotifier _rangeNotifier.DidRangeBeaconsInRegionComplete += DidRangeBeaconsInRegionComplete; _beaconManager.AddRangeNotifier(_rangeNotifier); _fieldRegion = new AltBeaconOrg.BoundBeacon.Region(AppConstants.AppUUID, null, null, null); _beaconManager.Bind(_mainActivity); return(_beaconManager); }