2

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..

zontar
  • 485
  • 7
  • 18

1 Answers1

3

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.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • 1
    Can you point me to an official Apple doc that states clearly that only iBeacon can wake apps from sleeping/dead state? The above document is a little bit vague for non technical people, and I need one to show to a customer :) – zontar Oct 18 '17 at 08:22
  • 1
    Sorry, I am sure no such documentation exists. (Unfortunately, you'll be hard pressed to find any reference to any Google technology like Eddystone n Apple docs -- they like to pretend it does not exist.) However, I can tell you I discussed this exact issue with Google's design engineers on the Eddystone project before it's release, and we agreed the solution described above is the way to get a background launch on iOS using Eddystone. – davidgyoung Oct 18 '17 at 09:49
  • 1
    Thanks!! I'll take your word for it. – zontar Oct 20 '17 at 10:39