Estimote SDK - Beacons raging in background

2019-09-04 09:27发布

First question is better is Estimote SDK or CoreLocation framework? I have app which is finding the beacons but now i must made an app which will find beacons when application is in background or even is terminated.

1条回答
戒情不戒烟
2楼-- · 2019-09-04 10:17

Setting up background detection is pretty automatic in iOS so long as you do it in your AppDelegate and receive callbacks in that class:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    _locationManager = [[CLLocationManager alloc] init];
    _locationManager.delegate = self;
    CLBeaconRegion *region;

    region = [[CLBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:@"2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6"] major: 1 minor: 1 identifier: @"region1"];
    region.notifyEntryStateOnDisplay = YES;
    [_locationManager startMonitoringForRegion:region];
    [_locationManager startRangingBeaconsInRegion:region];

    return YES;
}

You can read more about what you can expect from detection times in the background here:

http://developer.radiusnetworks.com/2013/11/13/ibeacon-monitoring-in-the-background-and-foreground.html

查看更多
登录 后发表回答