Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Nearables example that doesn't work
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