Search code examples
ioswatchkitibeaconapple-watchwatchos-2

watch OS 2 beacon monitoring and ranging


has anybody found any information about interacting (ranging and monitoring) with Beacons in native Watch OS 2 applications? I would like to give the user the possibility to range one in an home environment without having the phone in their pocket. I can't find any docs anywhere and I am wondering if it's actually feasible - and obviously if there is any kind of example around. Thanks


Solution

  • Core Location on watchOS is stripped of all the iBeacon functionality. There are no startRangingBeaconsInRegion: and startMonitoringForRegion: methods, as can be seen in the CLLocationManager reference documentation:

    https://developer.apple.com/library/watchos/documentation/CoreLocation/Reference/CLLocationManager_Class/

    The only option for now is to do the ranging/monitoring on the iPhone, and pass the results to the Watch app via the Watch Connectivity Framework.

    UPDATE for watchOS 4: still no iBeacon in Core Location, but there's now Core Bluetooth available for the watchOS apps, which means your app can detect non-iBeacon packets, such as Eddystone, or Estimote's Nearable/Telemetry.

    Only if your app is in the foreground or has execution time though. The latter meaning that, for example, if your app is already running in the background because you're using the new "location updates" background mode for turn-by-turn navigation, or you're tracking workouts in the background, then you can at the same time scan for beacons. In and on itself, detecting Bluetooth beacons won't keep your app alive in the background, it will get suspended.