public override void ViewDidLoad() { base.ViewDidLoad (); Title = "Distance Demo"; backgroundImage = new UIImageView(UIImage.FromFile ("distance_bkg")); backgroundImage.Frame = UIScreen.MainScreen.Bounds; backgroundImage.ContentMode = UIViewContentMode.ScaleToFill; View.AddSubview (backgroundImage); View.BackgroundColor = UIColor.White; //var beaconImageView = new UIImageView (UIImage.FromFile ("beacon_linearnie")); //beaconImageView.Center = new CoreGraphics.CGPoint (View.Center.X, 100); //View.AddSubview (beaconImageView); positionDot = new UIImageView (UIImage.FromFile ("dot_image")); positionDot.Center = View.Center; View.AddSubview (positionDot); //Beacon manager setup. beaconManager = new BeaconManager (); beaconRegion = new BeaconRegion (beacon.ProximityUUID, beacon.Major, beacon.Minor, "BeaconSample"); beaconManager.StartRangingBeacons(beaconRegion); beaconManager.RangedBeacons += (sender, e) => { if(e.Beacons.Length == 0) return; var first = e.Beacons[0]; UpdateDotPosition(first.Distance.FloatValue); }; }
public override void ViewDidLoad() { base.ViewDidLoad (); Title = "Notification Demo"; beaconManager = new BeaconManager (); beaconRegion = new BeaconRegion (Beacon.ProximityUUID, Beacon.Major, Beacon.Minor, "BeaconSample"); beaconRegion.NotifyOnEntry = enterSwitch.On; beaconRegion.NotifyOnExit = exitSwitch.On; enterSwitch.ValueChanged += HandleValueChanged; exitSwitch.ValueChanged += HandleValueChanged; beaconManager.StartMonitoring (beaconRegion); beaconManager.ExitedRegion += (sender, e) => { var notification = new UILocalNotification(); notification.AlertBody = "Exit region notification"; UIApplication.SharedApplication.PresentLocalNotificationNow(notification); }; beaconManager.EnteredRegion += (sender, e) => { var notification = new UILocalNotification(); notification.AlertBody = "Enter region notification"; UIApplication.SharedApplication.PresentLocalNotificationNow(notification); }; }
public async override void ViewDidLoad () { base.ViewDidLoad (); this.Title = "Select Beacon"; beaconManager = new BeaconManager (); beaconManager.ReturnAllRangedBeaconsAtOnce = true; region = new BeaconRegion (AppDelegate.BeaconUUID, "BeaconSample"); beaconManager.AuthorizationStatusChanged += (sender, e) => { StartRangingBeacons(); }; }
/// <summary> /// Rangeds the beacons. /// </summary> /// <param name="UUID">UUI.</param> void RangedBeacons (string UUID) { SystemLogger.Log (SystemLogger.Module.PLATFORM, "RangedBeacons UUID " + UUID); if (UUID != null) { var uuid = new NSUuid (UUID); region = new BeaconRegion (uuid, "BeaconSample"); } else { region = new BeaconRegion (null, "BeaconSample"); } beaconManager.StartRangingBeacons(region); //TODO should call other appverse listeners? beaconDict.Clear(); //beaconArray = new List<Appverse.Core.iBeacon.Beacon> (); try{ // Declare a timer: same steps in C# and VB tmr = new Timer(); tmr.AutoReset = false; tmr.Interval = 5000; // 0.1 second tmr.Elapsed += timerHandler; // We'll write it in a bit tmr.Start(); // The countdown is launched! }catch(Exception e){ SystemLogger.Log (SystemLogger.Module.PLATFORM, "Could not create the timer, STOP mannually. Exception: " + e.Message); } }
public override void RequestStateForRegion(BeaconRegion region) { iOSBeaconRegion iOSRegion = region as iOSBeaconRegion; CLLocationManager.RequestState(iOSRegion.CLBeaconRegion); }
public override void StopMonitoring(BeaconRegion region) { iOSBeaconRegion iosRegion = region as iOSBeaconRegion; CLLocationManager.StopMonitoring(iosRegion.CLBeaconRegion); }
public override void RequestStateForRegion(BeaconRegion region) { // add to a list the region they requested BeaconRegionsRequestingState.Add(region); }
public DroidRegionStateDeterminedEventArgs(int state, Region droidRegion) { State = state; BeaconRegion = new DroidBeaconRegion(droidRegion); }
public DroidRegionEventArgs(BeaconRegion region) { DroidRegion = (region as DroidBeaconRegion).Region; }
private void BeaconManagerAuthorizationStatusChanged(object sender, AuthorizationStatusChangedArgsEventArgs e) { if (e.Status == CoreLocation.CLAuthorizationStatus.AuthorizedWhenInUse) { var uuid = new NSUuid ("B9407F30-F5F8-466E-AFF9-25556B57FE6D"); var region = new BeaconRegion(uuid, "MyRegion"); _beaconManager.StartRangingBeacons(region); } }
public void LookForBeacon(BeaconRegion region, Beacon beacon) { _beacon = beacon; _region = region; BeaconManager.Connect(this); }
public IObservable <Beacon> WhenBeaconRanged(BeaconRegion region) => this.BeaconSubject.Where(region.IsBeaconInRegion);
public static IObservable <Beacon> WhenBeaconRanged(BeaconRegion region) => Current.WhenBeaconRanged(region);
public static Task StartMonitoring(BeaconRegion region) => Current.StartMonitoring(region);