I am using CLLocationManager object to start beacon ranging as per below code. Also enable the Background mode from Target -> Capabilities.
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy=kCLLocationAccuracyBest;
locationManager.distanceFilter=kCLDistanceFilterNone;
locationManager.pausesLocationUpdatesAutomatically = NO;
[locationManager requestAlwaysAuthorization];
Also add the AllowsBackgroundLocatoinUpdates to YES
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9) {
locationManager.allowsBackgroundLocationUpdates = YES;
}
A Boolean value indicating whether the app wants to receive location updates when suspended.
Created on CLBeaconRegion object to range beacon like as
CLBeaconRegion *beacon_Region;
beacon_Region = [[CLBeaconRegion alloc] initWithProximityUUID:uuid major:mjorVa minor:minorVa identifier:tmpStrIdentifier];
beacon_Region.notifyEntryStateOnDisplay = YES;
beacon_Region.notifyOnEntry=YES;
beacon_Region.notifyOnExit=YES;
[locationManager startRangingBeaconsInRegion:beacon_Region];
It's ranging in Background mode in some period of time like 10 minutes or some time 20 minutes but not in infinite.
How to maximize beacon responsiveness:
1.For the fastest monitoring detection times in the foreground, do ranging whenever you are monitoring, even if you don’t care about ranging updates. Like this:
2.If you want to get a guaranteed extra monitoring update in the background whenever the users wakes up their phone, set the notifyEntryStateOnDisplay option on your region as so:
IF YOU WANT TO MORE THEN PLEASE FOLLOW THIS ARTICLE