Skip to content

Instantly share code, notes, and snippets.

@jimbobbennett
Created October 8, 2015 06:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimbobbennett/c92e33c3ce19bc1f8abe to your computer and use it in GitHub Desktop.
Save jimbobbennett/c92e33c3ce19bc1f8abe to your computer and use it in GitHub Desktop.
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