Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
                //

                // 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( );
                    }
                }