Q1:
I feel there’s slight confusion here between an attachment and a proximity zone. (Good to know, we can try to disambiguate this better!)
In your case, you actually want 3 different proximity zones with the same attachment, not 3 different attachments:
let zone1 = EPXProximityZone(
range: EPXProximityRange(desiredMeanTriggerDistance: 1.0)!,
attachmentKey: "venue", attachmentValue: "coffee-shop-1")
zone1.onEnterAction = { _ in showCampaign("campaign-near") }
let zone2 = EPXProximityZone(
range: EPXProximityRange(desiredMeanTriggerDistance: 3.0)!,
attachmentKey: "venue", attachmentValue: "coffee-shop-1")
zone2.onEnterAction = { _ in showCampaign("campaign-mid") }
let zone3 = EPXProximityZone(
range: EPXProximityRange(desiredMeanTriggerDistance: 5.0)!,
attachmentKey: "venue", attachmentValue: "coffee-shop-1")
zone3.onEnterAction = { _ in showCampaign("campaign-far") }
Q2:
Right now, in this scenario (customer installs the app, and the app starts proximity-observing before the coffee shop owner sets up any beacons), you’ll get an error during startObserving
:
Not all zones have devices assigned to them. Please double check spelling in zones naming and confirm with your Cloud account.
That is, it’s not possible to start observing for zone that at the time doesn’t have any matching beacons in Estimote Cloud.
However, this was already pointed out to us as problematic behavior, so we’re changing it. Proximity observation will start even if there are no matching beacons, and if you later add some in Estimote Cloud, they will generate enter events as expected.
In fact, this change is already implemented in the Android Proximity SDK, but not yet in the iOS Proximity SDK.
Q3:
This is actually up to you, but you can make it work. When the customer enters the coffee shop, the Proximity SDK will trigger an enter event for beacon 1. You send that information to your backend. The owner adds a campaign, the backend checks if there are any customers already inside the coffee shop that match the campaign’s criteria, and sends a push notification to them.