Ejemplo n.º 1
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // get your app ID and token on:
            // https://cloud.estimote.com/#/apps/add/your-own-app
            var creds = new CloudCredentials("app ID", "app token");

            observer = new ProximityObserver(creds, (error) =>
            {
                Debug.WriteLine($"error = {error}");
            });

            var range = new ProximityRange(1.0);

            var zone1 = new ProximityZone("lobby", range)
            {
                OnEnter = (context) =>
                {
                    Debug.WriteLine($"zone1 enter, context = {context}");
                },
                OnExit = (context) =>
                {
                    Debug.WriteLine($"zone1 exit, context = {context}");
                },
                OnContextChange = (contexts) =>
                {
                    Debug.WriteLine($"zone1 contextChange, contexts = {contexts}");
                }
            };

            var zone2 = new ProximityZone("conf-room", range)
            {
                OnEnter = (context) =>
                {
                    Debug.WriteLine($"zone2 enter, context = {context}");
                },
                OnExit = (context) =>
                {
                    Debug.WriteLine($"zone2 exit, context = {context}");
                },
                OnContextChange = (contexts) =>
                {
                    Debug.WriteLine($"zone2 contextChange, contexts = {contexts}");
                }
            };

            observer.StartObservingZones(new ProximityZone[] { zone1, zone2 });

            Debug.WriteLine("Proximity all ready to go!");

            return(true);
        }
Ejemplo n.º 2
0
 public void SetProximity(ProximityRange range)
 {
     this.range = range;
 }