Reputation: 23
I have written a small iBeacon demo app that ranges for beacons and then will monitor for beacons in range after they have been found for the first time. After I run this app (if it's still in the background), I find that the device has trouble making new Bluetooth connections. When I enter my car, for instance, my car infinitely tries to connect to the phone with no success until I turn Bluetooth off and on again. This seems like an issue of keeping Bluetooth active after leaving the area of the iBeacons, but I have stopped ranging for beacons on didExitRegion. I have even attempted stopping ranging for beacons when the view disappears or when the app is closed. Is there some other step to take in order to properly close connections when leaving a range?
Edit: I only say ranging in the OP, but I have since also made sure to stop monitoring for beacon regions when the app goes inactive and when exiting regions. The problem persists
Edit 2: If I must say specific behavior expected, I expect to be able to range and monitor for beacons while the app is running and while it is in the background without stopping up other Bluetooth connections. The actual behavior is that it does keep track of beacons in these cases, but it doesn't allow other bluetooth connections to be formed.
Code to initialize and start monitoring for beacons (in viewDidLoad):
if (self.beaconManager == nil) {
self.beaconManager = [[ESTBeaconManager alloc] init];
self.beaconManager.delegate = self;
}
if (self.icyMarshmallowRegion == nil) {
self.icyMarshmallowRegion = [[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTE_PROXIMITY_UUID major:[kIcyMarshmallowMajor integerValue] minor:[kIcyMarshmallowMinor integerValue] identifier:kIcyMarshmallowRegionID];
self.icyMarshmallowRegion.notifyOnEntry = YES;
self.icyMarshmallowRegion.notifyEntryStateOnDisplay = YES;
}
[self.beaconManager startMonitoringForRegion:self.icyMarshmallowRegion];
Code to stop monitoring (in didExitRegion):
[self.beaconManager stopMonitoringForRegion:self.icyMarshmallowRegion];
Upvotes: 2
Views: 899
Reputation: 874
There is no more step to "close the Bluetooth activity", and anyway your device should be able to take other connections while monitoring for iBeacon
regions (I'm not sure for ranging cause it's more an 'active' task, but I bet it's the same thing)
I've seen a lot of strange behaviour related to iBeacon
in iOS7
, part of them are fixed in iOS8
, hopefully everything will be soon ok. I think you shouldn't worry about your code for the problem you describe, and wait for iOS8
Upvotes: 1