Search code examples
iosswiftibeacongeofencingeddystone

Can iOS device detect Eddystone beacon when app is killed/suspended?


I need to write an app that calls a REST service each time it is near an Eddystone beacon. My target is iOS 9 or greater and writing in Swift.

So far I have managed to have the app respond to advertisement from the beacon when the app is in foreground and when the app is in background for a few hours. Then after a few hours that the app is in background, nothing happens.

I suspect the app is killed by the OS or suspended.

The first thing I tried was geofencing with CLLocationManager and CLBeaconRegion. But after googling around I gathered that this only works with iBeacon, and my beacon uses for sure the Eddystone protocol.

As per Apple docs, a geofencing on an iBeacon should "awake" the app even if the app has been killed (either by a human or by the OS).. can I have a similar behaviour with an Eddystone beacon?

I think not, but in this case I'd like a definitive answer :)

Thanks

BTW, this doc https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/LocationAwarenessPG/RegionMonitoring/RegionMonitoring.html

talks sometimes about Beacons and some other about iBeacons, so it's not super clear if this applies only to iBeacons or not. Given the format of the UUID I think it does, but..


Solution

  • You can use iOS CoreLocation APIs to launch an app into the background on beacon detection when monitoring for a CLBeaconRegion object. This only works with iBeacon and not with Eddystone, because CoreLocation only detects iBeacon.

    To detect Eddystone on iOS, you must use CoreBluetooth APIs, which do not offer this feature.

    A common approach to do what you want is to use a beacon that interleaves both Eddystone and iBeacon. Use the iBeacon for launching your app and Eddystone for further processing.