Reputation: 7139
I'm trying to find how to scan for iBeacons in the background but as far as I understood you can only check when the user enters a region, I tried to enable Background Modes then I NSLog the 2 methods that should work in background:
- (void)locationManager:(KTKLocationManager *)locationManager didEnterRegion:(KTKRegion *)region
{
NSLog(@"Enter region %@", region.uuid);
}
- (void)locationManager:(KTKLocationManager *)locationManager didExitRegion:(KTKRegion *)region
{
NSLog(@"Exit region %@", region.uuid);
}
But the devices doesn't seem to scan while in background, what am I missing?
Upvotes: 1
Views: 619
Reputation: 41
It's very simple to achieve with Kontakt.io SDK :) Just check this link http://docs.kontakt.io/ios-sdk/quickstart/#ios-8-compatibility. I believe you didn't add this to your plist. When you have it added then in your app after allowing to access your location by app, methods:
- (void)locationManager:(KTKLocationManager *)locationManager didEnterRegion:(KTKRegion *)region;
- (void)locationManager:(KTKLocationManager *)locationManager didExitRegion:(KTKRegion *)region
will be called and what is even more cool if you'll receive didEnterRegion then automatically will be called(few times) method:
- (void)locationManager:(KTKLocationManager *)locationManager didRangeBeacons:(NSArray *)beacons;
Of course how to extend background time etc. is a different topic ;)
Upvotes: 1