Beacons in iOS and Android
An overview of how beacons are supported in iOS and Android
It's probably no surprise - iOS and Android have different levels of beacon support.
What is a Beacon?
I should clarify 'beacon' - a beacon is just a Bluetooth Low Energy peripheral that uses a defined advertisement structure.
There are several standard definitions for beacon advertisements - each with its own pros/cons. Some of the more common standards are iBeacon, Eddystone, and AltBeacon.
Apple created iBeacon, Google came up with Eddystone, and AltBeacon is an open-source alternative to both.
How do iOS and Android Support Beacons?
iOS has built-in support for iBeacon detection. Android used to have Eddystone support, but that has been deprecated. The 3rd party Alt-Beacon fills this void for Android devices.
On both iOS and Android, you can
- detect iBeacons in the foreground and background consistently
- know when the phone enters or leaves the proximity of a beacon.
- know how far away the phone is from the beacon.
- trigger code when nearby an iBeacon, even if the app is closed
A big thing to note here is that proximity to a beacon is calculated by averaging RSSI values over time. Lots of things can make RSSI fluctuate - so the estimated distances are more precise at small distances.
If you want to detect another beacon standard, like AltBeacon, this is possible on iOS and Android, but it will not work as consistently on iOS as iBeacon detection.
This is because iOS has a separate API dedicated to iBeacon detection in addition to its normal Bluetooth APIs. Detection of non-iBeacon peripherals requires the 'normal' Bluetooth APIs for peripheral scanning.