观看OS 2信标监控和测距

时间:2015-10-06 07:55:35

标签: ios watchkit ibeacon apple-watch watch-os-2

有没有人在本机Watch OS 2应用程序中找到有关与Beacons进行交互(测距和监控)的任何信息? 我想让用户有可能在家庭环境中放置一个,而无需将手机放在口袋里。 我无法在任何地方找到任何文档,我想知道它是否真的可行 - 显然是否有任何类型的例子。 感谢

2 个答案:

答案 0 :(得分:2)

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.

答案 1 :(得分:0)

directly use watch to monitor/ranging with watchOS is prohibited by Apple (it detailed in developer document). It mean you can not turn bluetooth on watch and start monitoring directly! But there're another way, you can integrate app with watchOS, I gave a tried before with our app and it work pretty good. We're using Estimote, you can refer right here: Estimote Watch SDK Integration

It can be transport notification from iOS device to watch. They provide several helpers support that. Good luck!