public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. // craete manager instance var myBeaconManager = new BeaconManager(this); beaconManager = new ESTBeaconManager(); beaconManager.Delegate = myBeaconManager; beaconManager.AvoidUnknownStateBeacons = true; // create sample region with major value defined Console.WriteLine("TODO: Update the ESTBeaconRegion with your major / minor number and enable background app refresh in the Settings on your device for the NotificationDemo to work correctly."); ESTBeaconRegion region = new ESTBeaconRegion(1, 1, "Estimote Sample Region"); // start looking for estimote beacons in region // when beacon ranged beaconManager.DidRangeBeacons // and beconManager.DidExitRegion invoked beaconManager.StartMonitoring(region); beaconManager.RequestState(region); ///////////////////////////////////////////////////////////// // setup view // background productImage = new UIImageView(UIScreen.MainScreen.Bounds); SetProductImage(); this.View.AddSubview(productImage); }
public override void DidRangeBeacons(ESTBeaconManager manager, NSArray[] beacons, ESTBeaconRegion region) { if (beacons.Length > 0) { if (vc.selectedBeacon == null) { // initially pick the closest beacon vc.selectedBeacon = (ESTBeacon)beacons.GetValue(0); } else { for (int i = 0; i < beacons.Length; i++) { ESTBeacon cBeacon = (ESTBeacon)beacons.GetValue(i); // update beacon if same as selected initially if ((vc.selectedBeacon.Ibeacon.Major.UnsignedIntegerValue == cBeacon.Ibeacon.Major.UnsignedIntegerValue) && (vc.selectedBeacon.Ibeacon.Minor.UnsignedIntegerValue == cBeacon.Ibeacon.Minor.UnsignedIntegerValue)) { vc.selectedBeacon = cBeacon; } } } // based on observation rssi is not getting bigger than -30 // so it changes from -30 to -100 so we normalize float distFactor = ((float)vc.selectedBeacon.Ibeacon.Rssi + 30) / -70; // calculate and set new y position float newYPos = (vc.dotMinPos + distFactor * vc.dotRange); vc.positionDot.Center = new PointF(vc.View.Bounds.Size.Width / 2, newYPos); } }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. distanceLabel = new UILabel(new RectangleF(37f, 232f, 247f, 73f)); distanceLabel.TextAlignment = UITextAlignment.Center; distanceLabel.Lines = 0; distanceLabel.TextColor = UIColor.White; distanceLabel.Text = "Loading Beacons..."; this.View.AddSubview(distanceLabel); // craete manager instance var myBeaconManager = new BeaconManager(this); beaconManager = new ESTBeaconManager(); beaconManager.Delegate = myBeaconManager; beaconManager.AvoidUnknownStateBeacons = true; // create sample region object (you can additionaly pass major / minor values) ESTBeaconRegion region = new ESTBeaconRegion("Estimote Sample Region"); // start looking for estimote beacons in region // when beacon ranged beaconManager:didRangeBeacons:inRegion: invoked beaconManager.StartRangingBeacons(region); }
public override void ViewDidLoad() { base.ViewDidLoad (); // setup Estimote beacon manager var myBeaconManager = new BeaconManager(distanceLabel); estBeaconManager = new ESTBeaconManager(); estBeaconManager.Delegate = myBeaconManager; estBeaconManager.AvoidUnknownStateBeacons = true; // create sample region object (you can additionaly pass major / minor values) ESTBeaconRegion region = new ESTBeaconRegion("EstimoteSampleRegion"); // start looking for estimote beacons in region // when beacon ranged beaconManager:didRangeBeacons:inRegion: invoked estBeaconManager.StartRangingBeaconsInRegion(region); // Perform any additional setup after loading the view, typically from a nib. NavigationItem.LeftBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Bookmarks, delegate { navigation.ToggleMenu(); }); }
public EventListViewController_iPhone(FlyoutNavigationController navigation) : base("EventListViewController_iPhone", null) { this.navigation = navigation; // noticationCenter = true; beaconManage = new ESTBeaconManager (); }
public override void DidRangeBeacons(ESTBeaconManager manager, NSArray[] beacons, ESTBeaconRegion region) { if (beacons.Length > 0) { if (selectedBeacon == null) { // initialy pick closest beacon selectedBeacon = (ESTBeacon)beacons.GetValue(0); } else { for (int i = 0; i < beacons.Length; i++) { ESTBeacon cBeacon = (ESTBeacon)beacons.GetValue(i); // update beacon if same as selected initially if (selectedBeacon.Ibeacon.Major.UInt16Value == cBeacon.Ibeacon.Major.UInt16Value && selectedBeacon.Ibeacon.Minor.UInt16Value == cBeacon.Ibeacon.Minor.UInt16Value) { selectedBeacon = cBeacon; } } } // beacon array is sorted based on distance // closest beacon is the first one string labelTextStr = String.Format("Beacon: {0} \nMajor: {1}, Minor: {2}\nRSSI: {3}\nRegion: ", selectedBeacon.Ibeacon.ProximityUuid.AsString(), selectedBeacon.Ibeacon.Major.UInt16Value, selectedBeacon.Ibeacon.Minor.UInt16Value, selectedBeacon.Ibeacon.Rssi ); // calculate and set new y position switch (selectedBeacon.Ibeacon.Proximity) { case CLProximity.Unknown: labelTextStr += "Unknown"; break; case CLProximity.Immediate: labelTextStr += "Immediate"; break; case CLProximity.Near: labelTextStr += "Near"; break; case CLProximity.Far: labelTextStr += "Far"; break; } NSString labelText = new NSString(labelTextStr); _distanceLabel.Text = labelText; } }
public override void DidRangeBeacons(ESTBeaconManager manager, NSArray[] beacons, ESTBeaconRegion region) { if (beacons.Length > 0) { if (vc.selectedBeacon == null) { vc.selectedBeacon = (ESTBeacon)beacons.GetValue(0); } else { for (int i = 0; i < beacons.Length; i++) { ESTBeacon cBeacon = (ESTBeacon)beacons.GetValue(i); // update beacon if same as selected initially if ((vc.selectedBeacon.Ibeacon.Major.UnsignedIntegerValue == cBeacon.Ibeacon.Major.UnsignedIntegerValue) && (vc.selectedBeacon.Ibeacon.Minor.UnsignedIntegerValue == cBeacon.Ibeacon.Minor.UnsignedIntegerValue)) { vc.selectedBeacon = cBeacon; } } } // beacon array is sorted based on distance // closest beacon is the first one string labelText = string.Format("Major: {0}, Minor: {1}\nRegion: ", vc.selectedBeacon.Ibeacon.Major.UnsignedIntegerValue, vc.selectedBeacon.Ibeacon.Minor.UnsignedIntegerValue); // calculate and set new y position switch (vc.selectedBeacon.Ibeacon.Proximity) { case CLProximity.Unknown: labelText += "Unknown"; break; case CLProximity.Immediate: labelText += "Immediate"; break; case CLProximity.Near: labelText += "Near"; break; case CLProximity.Far: labelText += "Far"; break; default: break; } vc.distanceLabel.Text = labelText; } }
public override void DidDetermineState(ESTBeaconManager manager, CLRegionState state, ESTBeaconRegion region) { if (state == CLRegionState.Inside) { vc.SetProductImage(); } else { vc.SetDiscountImage(); } }
public override void DidRangeBeacons(ESTBeaconManager manager, NSArray[] beacons, ESTBeaconRegion region) { if(beacons.Length > 0) { if(selectedBeacon == null) { // initialy pick closest beacon selectedBeacon = (ESTBeacon)beacons.GetValue(0); } else { for(int i=0;i<beacons.Length;i++) { ESTBeacon cBeacon = (ESTBeacon)beacons.GetValue(i); // update beacon if same as selected initially if(selectedBeacon.Ibeacon.Major.UInt16Value == cBeacon.Ibeacon.Major.UInt16Value && selectedBeacon.Ibeacon.Minor.UInt16Value == cBeacon.Ibeacon.Minor.UInt16Value) { selectedBeacon = cBeacon; } } } // beacon array is sorted based on distance // closest beacon is the first one string labelTextStr = String.Format("Beacon: {0} \nMajor: {1}, Minor: {2}\nRSSI: {3}\nRegion: ", selectedBeacon.Ibeacon.ProximityUuid.AsString(), selectedBeacon.Ibeacon.Major.UInt16Value, selectedBeacon.Ibeacon.Minor.UInt16Value, selectedBeacon.Ibeacon.Rssi ); // calculate and set new y position switch(selectedBeacon.Ibeacon.Proximity) { case CLProximity.Unknown: labelTextStr += "Unknown"; break; case CLProximity.Immediate: labelTextStr += "Immediate"; break; case CLProximity.Near: labelTextStr += "Near"; break; case CLProximity.Far: labelTextStr += "Far"; break; } NSString labelText = new NSString(labelTextStr); _distanceLabel.Text = labelText; } }
public override void DidExitRegion(ESTBeaconManager manager, ESTBeaconRegion region) { // iPhone/iPad left beacon zone vc.SetDiscountImage(); // present local notification UILocalNotification notification = new UILocalNotification(); notification.AlertBody = "The shoes you'd tried on are now 20%% off for you with this coupon"; notification.SoundName = UILocalNotification.DefaultSoundName; UIApplication.SharedApplication.PresentLocationNotificationNow(notification); }
public override void DidEnterRegion(ESTBeaconManager manager, ESTBeaconRegion region) { // iPhone/iPad entered beacon zone vc.SetProductImage(); // present local notification UILocalNotification notification = new UILocalNotification(); notification.AlertBody = "You entered the region!"; notification.SoundName = UILocalNotification.DefaultSoundName; UIApplication.SharedApplication.PresentLocationNotificationNow(notification); }
private void SetupManager() { // create estimote manager instance and assign it's delegates var myBeaconManager = new BeaconManager(this); beaconManager = new ESTBeaconManager(); beaconManager.Delegate = myBeaconManager; beaconManager.AvoidUnknownStateBeacons = true; // create sample region object (you can additionally pass major/minor values) ESTBeaconRegion region = new ESTBeaconRegion("Estimote Sample Region"); // start looking for estimote beacons in region // when beacon ranged beaconManager.DidRangeBeacons invoked beaconManager.StartRangingBeacons(region); }
public override void ViewDidLoad() { base.ViewDidLoad(); // setup Estimote beacon manager var myBeaconManager = new BeaconManager(distanceLabel); estBeaconManager = new ESTBeaconManager(); estBeaconManager.Delegate = myBeaconManager; estBeaconManager.AvoidUnknownStateBeacons = true; // create sample region object (you can additionaly pass major / minor values) ESTBeaconRegion region = new ESTBeaconRegion("EstimoteSampleRegion"); // start looking for estimote beacons in region // when beacon ranged beaconManager:didRangeBeacons:inRegion: invoked estBeaconManager.StartRangingBeacons(region); }
public override void ViewDidLoad() { base.ViewDidLoad (); // setup Estimote beacon manager var myBeaconManager = new BeaconManager(distanceLabel); estBeaconManager = new ESTBeaconManager(); estBeaconManager.Delegate = myBeaconManager; estBeaconManager.AvoidUnknownStateBeacons = true; // create sample region object (you can additionaly pass major / minor values) ESTBeaconRegion region = new ESTBeaconRegion("EstimoteSampleRegion"); // start looking for estimote beacons in region // when beacon ranged beaconManager:didRangeBeacons:inRegion: invoked estBeaconManager.StartRangingBeacons(region); }
public override void DidRangeBeacons(ESTBeaconManager manager, NSArray[] beacons, ESTBeaconRegion region) { ESTBeacon beacon = (ESTBeacon)beacons.GetValue (0); if (beacon.Ibeacon.Proximity == CLProximity.Near) { label.Text = "It's Near"; imageView.Image = UIImage.FromFile ("near_image.PNG"); } if (beacon.Ibeacon.Proximity == CLProximity.Far) { label.Text = "It's Far"; imageView.Image = UIImage.FromFile ("far_image.PNG"); } if (beacon.Ibeacon.Proximity == CLProximity.Immediate) { label.Text = "It's Immediate"; imageView.Image = UIImage.FromFile ("immediate_image.PNG"); } if (beacon.Ibeacon.Proximity == CLProximity.Unknown) { label.Text = "It's Unknown"; imageView.Image = UIImage.FromFile ("unknown_image.PNG"); } }
// public override void DidRangeBeacons (ESTBeaconManager manager, NSArray[] beacons, ESTBeaconRegion region) // { // ESTBeacon beacon = (ESTBeacon)beacons.GetValue (0); // setNotification (); // } public override void DidEnterRegion(ESTBeaconManager manager, ESTBeaconRegion region) { if(region.Major.ToString().Equals("46790")) setNotification (); // setNotification2 (region); }
public EstimoteProximityController(FlyoutNavigationController navitation) : base("EstimoteProximityController", null) { this.navigation = navitation; beaconManager = new ESTBeaconManager(); }
private void DidRangeBeacons(ESTBeaconManager manager, NSArray[] beacons, ESTBeaconRegion region) { }