Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is iBeacon support REALLY changed in iOS 7.1?

Tags:

ibeacon

ios7.1

I've seen claims on the net that the newly released iOS 7.1's iBeacon support.

Specifically:

  1. The system is supposed to still notify your app about didEnterRegion/didExitRegion events, even if the user explicitly kills your app.
  2. didEnterRegion/didExitRegion notifications are supposed to be faster from the background and/or with the device locked.

I have not been able to confirm either of these claims with my own testing. In fact, I seem to be less likely to get didEnterRegion/didExitRegion notifications from a locked device. (more accurately I seem to get didEnterRegion notices, but not didExitRegion notices). That could be because Apple made me remove my BLE background mode entries in my info.plist - I'm not completely sure. I'm still trying to sort this out.

like image 944
Duncan C Avatar asked Mar 12 '14 20:03

Duncan C


2 Answers

I had trouble setting up my tests at first, but I have witnessed background region entry callbacks after killing an app in iOS 7.1 on both iPhone 4s and iPhone 5s models. See comments below for testing details and instructions to reproduce.

I have also done tests on background detection times on an iPhone 4S, and I still see delays of 15 minutes on iOS 7.1. My full test results and methodology are described here.

Finally, I have also done some tests on the fluctuations on the "accuracy" (distance in meters) measurement on the same device before and after the upgrade to iOS 7.1. I do not see an obvious difference in the noise on the estimate. The graphs below show results before and after the upgrade, with an iBeacon 0.5 meters away for 60 seconds then moved to 3 meters away for 60 seconds. In both cases, the transmitter was a properly calibrated iPhone 4S w/ iOS 7.1 and the receiver was an iPhone 5S.

iOS 7.0.6

iOS 7.0.6 Estimated distance

iOS 7.1

iOS 7.1 Estimated distance

like image 191
davidgyoung Avatar answered Jan 02 '23 15:01

davidgyoung


As has been mentioned in several articles circulating around the internet, beacon sensing is available even when you swipe your app away from the multi-tasking view. However in my experiments, a region enter/exit event doesn't call the didDetermineState: directly (Probably because I hadn't been using the AppDelegate to initiate any beacon sensing but instead triggering monitoring based on UI events). Instead if you have registered for Background Location Updates, your AppDelegate's didFinishLaunchingWithOptions: method would get called with the value for key UIApplicationLaunchOptionsLocationKey in the parameter launchOptions set.

You can do a simple check like this to test if this is indeed a location update that has bought your app into the background to perform some task.

if ([launchOptions objectForKey:UIApplicationLaunchOptionsLocationKey])

You can then either register your monitored regions again or start ranging immediately.

P.S. CLLocationManager retains your previously monitoredRegions on app restore but without starting monitoring again using the same UUID and identity, you would not get the enter/exit region event in CLLocationManagerDelegate (which had brought your back up to life)

like image 38
kodr Avatar answered Jan 02 '23 14:01

kodr