I´ve implemented a monitoring function for beacons (didEnterRegion). It works great if I use my iPhone. (App is in foreground, background or only installed and closed but my iPhone has to be in use (screen on).)
If my phone is in standBy mode (top button pressed), I get no notification with didEnterRegion. If I use my phone (screen on), the notification pop up. Is there an opportunity to get the didEnterRegion event also in the standby mode?
self->beaconLocationManager = [[CLLocationManager alloc] init];
[self->beaconLocationManager requestAlwaysAuthorization];
self->beaconLocationManager.delegate = self;
beaconLocationManager.allowsBackgroundLocationUpdates = YES;
NSString* beaconIdentName = [NSString stringWithFormat:@"Beacon%d", cnt];
NSUUID *uuid2=[[NSUUID alloc]initWithUUIDString:uuid];
clBeconRegion2=[[CLBeaconRegion alloc]initWithProximityUUID:uuid2 identifier:beaconIdentName];
clBeconRegion2.notifyOnEntry=YES;
clBeconRegion2.notifyEntryStateOnDisplay = NO;
[self->beaconLocationManager startMonitoringForRegion:clBeconRegion2];
[self->beaconLocationManager startRangingBeaconsInRegion:clBeconRegion2];
...
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {
NSLog(@"ENTER REGION");
UILocalNotification *localNotification = [[UILocalNotification alloc]init];
localNotification.alertBody = @"FOUNDED";
localNotification.alertAction = [NSString stringWithFormat:@"%@ Connecting...", region.identifier];
[[UIApplication sharedApplication]presentLocalNotificationNow:localNotification];
}
Project settings: Push notifications are on. Background modes for location updates, backgroudn fetch, uses bluetooth LE accessories are on.
Tested on iOS 11.1
How long have you waited for background detection? This can take up to 15 minutes.
See here for details: http://developer.radiusnetworks.com/2013/11/13/ibeacon-monitoring-in-the-background-and-foreground.html
As described in that article, you do not need to set location updates Background Mode to YES. Also you don't need to specify notifyOnExit and notifyOnEntry as true.
Hope this may help.