3

Here is a code I use to detect Eddystone using iPhone iOS 9:

- (void)viewDidLoad
{
    [super viewDidLoad];

    if ([CLLocationManager locationServicesEnabled]) {

        _locationManager = [[CLLocationManager alloc] init];
        self.locationManager.delegate = self;
        self.locationManager.pausesLocationUpdatesAutomatically = NO;
        [self.locationManager requestAlwaysAuthorization];

        NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@"f7826da6-4fa2-4e98-8024-bc5b71e0893e"];
        NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];

        CLBeaconRegion *beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:bundleIdentifier];
        self.locationManager.allowsBackgroundLocationUpdates = YES;
        [self.locationManager startMonitoringForRegion:beaconRegion];
        [self.locationManager startRangingBeaconsInRegion:beaconRegion];
        [self.locationManager startUpdatingLocation];
    }
    else {

        NSLog(@"location service is disabled");
    }
}

- (void)locationManager:(CLLocationManager *)manager
        didRangeBeacons:(nonnull NSArray<CLBeacon *> *)beacons
               inRegion:(nonnull CLBeaconRegion *)region
{
    NSLog(@"beacons count: %lu", (unsigned long)[beacons count]); // beacons count always "0"
}

Also I added in plist NSLocationAlwaysUsageDescription field.

The problem is that it can't detect any Eddystone device with code above. But with third party apps it finds well.

adding image proof that it's Eddystone beacon

What I'm doing wrong?

Serge
  • 2,031
  • 3
  • 33
  • 56
  • Please describe the problem... – Roy K Dec 12 '15 at 14:12
  • updated topic. please check out – Serge Dec 12 '15 at 14:21
  • The code shown will detect iBeacon compatible Bluetooth LE beacons, not Eddystone beacons. This is because the CoreLocation APIs shown do not support Eddystone. Can you confirm it is really an Eddystone beacon you are trying to detect? They have a very different identifier scheme from the id you have shown: f7326da6-4fa2-4e98-8024-bc5b71e0893e. Where did that id come from? – davidgyoung Dec 12 '15 at 15:57
  • davidgyoung, Why does other third party apps in App Store can detect my Eddystone? – Serge Dec 13 '15 at 13:22
  • Also added image which proofs that uuid is correct and it's Eddystone – Serge Dec 13 '15 at 13:52

1 Answers1

2

Your code is using Core Location, which only works with iBeacon. You won't be able to discover Eddystone beacons this way.

You need to use some Eddystone-compatible SDK. Since you seem to be using Kontakt.io's beacons, you might want to use their SDK:

http://developer.kontakt.io/ios-sdk/quickstart/#eddystone-support

Alternatively, you can use iOS's native Core Bluetooth to implement Eddystone scanning yourself. There's even an example on how to do that, available in the official Eddystone GitHub repo:

https://github.com/google/eddystone/tree/master/tools/ios-eddystone-scanner-sample

heypiotr
  • 2,139
  • 2
  • 15
  • 22