Apps detect and interact with beacons in two ways:
- Monitoring: actions triggered on entering/exiting region’s range; works no matter whether the app is running, suspended, or killed (if the app's not running when an enter/exit even comes, iOS will launch it into the background for a few seconds to handle the event)
- Ranging: actions triggered based on proximity to a beacon; works only when the app is running (e.g., it's displayed on screen, or running in the background in response to a monitoring event, etc.)
It’s important to remember that Monitoring allows you to scan for beacon regions, while Ranging is for interacting with individual beacons.
To learn more about beacon regions, read:
Monitoring
Monitoring a region enables your app to know when a device enters or exits the range of beacons defined by the region. Imagine a museum with an audio guide application and beacons installed by the two entrances. The app is monitoring for a region encompassing both beacons (think: ‘all entrance beacons’ region) and is notified whenever the user enters the museum. Then it launches a notification, reminding users about the audio guide feature.
![image](upload://yUYGMdYEVFJbA5tqdnfR5eedo4g.png)
And now the best part: all of this can happen even if the user has their phone in their pocket, locked! Region Monitoring works even when the application is not running—all that is needed is the app installed on the device.
Monitoring also has several limitations:
- iOS limits the number of regions an app can be monitoring at once to 20. No worries, the number of beacons in a single region is almost unlimited (strictly speaking, it's 4,294,836,225 beacons... quite a lot, right?)
- It requires the user to grant the app permission to "Access Your Location Even When You Are Not Using the App". You can read about handling Location Services permission elsewhere in our Knowledge Base.
- It only recognizes enter/exit events, and provides no information about which exact beacon triggered the event (only which region did), and no proximity estimations. (You can however, use the time iOS grants your app to handle the enter/exit event to run ranging for a few seconds, and learn both which exact beacons are in range, and what's their proximity.)
- It's not as responsive as ranging. Whereas ranging reports changes in beacons detected in range within seconds, monitoring's responsiveness varies as a result of using low-power scanning. If the device is currently or was recently in use, and is actively using WiFi/Bluetooth communication, the events are near instantaneous. In other scenarios, there might be a delay of up to a few minutes.
- Exit event is always delayed at least 30 seconds, to avoid false positives.
Ranging
While Monitoring enables you to detect movement in-and-out of range of the beacons, Ranging is more granular. It returns a list of beacons in range, together with an estimated proximity to each of them.
![image](upload://tdETEtpaPoP217iQU2nKX07nlpk.png)
Coming back to our museum example: imagine an "all beacons near the exhibits" region. The audio guide app can scan for all beacons in this region and then check which beacon is the closest. Since each beacon is associated with a particular exhibit, the app will play a description of an artwork relevant to the user’s context.
As Bluetooth Low Energy ranging depends on detecting radio signals, results will vary depending on the placement of Estimote beacons and whether a user's mobile device is in-hand, in a bag, or in a pocket. Clear line of sight between a mobile device and a beacon will yield better results so it is recommended that Estimote beacons not be hidden between shelves.
On iOS:
Ranging works only when the app is running, which most of the time means that the user is actively using the app. This also means that it only needs permission to "Access Your Location While You Use the App".
Note that there are certain scenarios on iOS when your app can be actively running in the background—ranging will also work in these (limited) scenarios. For more details, refer to the Is it possible to use beacon ranging in the background? article.