Search code examples
iosxamarinibeaconestimote

Simple Estimote (iBeacon) Xamarin example not working


I'm trying to detect Estimote iBeacons from Xamarin iPad app but the 'DidRangeBeacons' event is never fired.

locationManager = new CLLocationManager();
var beaconId = new NSUuid("B9407F30-F5F8-466E-AFF9-25556B57FE6D");
beaconRegion = new CLBeaconRegion(beaconId, "Test Region");

locationManager.DidRangeBeacons +=  ( sender, e) => {
foreach (var beacon in e.Beacons) {
    Console.WriteLine(beacon.Major +"-"+ beacon.Minor +": " + beacon.Proximity +" " + beacon.Accuracy);
    }
};

locationManager.StartRangingBeacons (beaconRegion);
Console.WriteLine ("Starting Ranging"); 

The code above runs inside a ViewDidLoad method.

Do I need to configure anything else to detect the iBeacons?

The code is running on an iPad & the standard Estimote app detects the iBeacons


Solution

  • This was resolved by adding 'NSLocationAlwaysUsageDescription' or 'NSLocationWhenInUseUsageDescription' to the plist.info file as described at Location Services not working in iOS 8