Created
October 8, 2015 06:52
-
-
Save jimbobbennett/c92e33c3ce19bc1f8abe to your computer and use it in GitHub Desktop.
Nearables example that doesn't work
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override void ViewDidLoad() | |
{ | |
base.ViewDidLoad(); | |
var beaconManager = new BeaconManager(); | |
beaconManager.AuthorizationStatusChanged += (s, e) => | |
{ | |
var manager = new NearableManager(); | |
manager.RangedNearables += (sender, e1) => | |
{ | |
if (e1.Nearables.Any(n => n.Type != NearableType.Unknown)) | |
{ | |
// this is never shown as the Type is never set to anything other than Unknwon | |
new UIAlertView("Nearables Found", "Just found: " + e1.Nearables.Length + " nearables.", null, "OK").Show(); | |
} | |
}; | |
// using StartRangingForIdentifier means the RangedNearables event fires with an empty Nearables collection | |
//manager.StartRangingForIdentifier("a14f2bd4fdb99a3d"); | |
// using StartRangingForType with a specified type means the RangedNearables event fires with an empty Nearables collection | |
//manager.StartRangingForType(NearableType.Fridge); | |
// using StartRangingForType with a type of all means the RangedNearables event fires with all the nearables in it's collection | |
// but the type field on the nearables is Unknown | |
manager.StartRangingForType(NearableType.All); | |
}; | |
beaconManager.RequestAlwaysAuthorization(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment