Reputation: 13833
I want to detects beacon/ibeacon devices near my iphone's proximity. I am not sure which class i should use
Should i use CLBeacon and CLBeaconRegion and start monitoring region
OR
Should i use CBcentralManager and scanForPeripheralsWithServices
Which api suited best for which use case ?
I have tried to find it online but it's not documented anywhere
Upvotes: 0
Views: 815
Reputation: 5888
CLBeacon and CLBeaconRegion are handy and able to get information in background.
CBcentralManager is not only for BLE, it can detect other legacy bluetooth device like mouse, keyboard, etc.
Upvotes: 0
Reputation: 114866
Although iBeacons use Bluetooth Low Energy (BLE), they are not treated as a BLE peripheral in iOS. They are handled via the CoreLocation framework, so the classes you need are CLLocationManager
, CLRegion
and CLBeacon
. Refer to the Core Location Programming Guide
CBCentralManager is for BLE peripherals such as heart rate monitors, fitness trackers (or anything else you can think of where you want to exchange data with the peripheral)
Upvotes: 3