Apple Watch - detect if watch is locked

邮差的信 提交于 2019-12-23 20:33:02

问题


I am working on an app, which requires the user to have the apple watch actually on-body. So, whenever the user puts the watch off his wrist, the iPhone app should detect that and stop different tasks immediately.

Initially, I thought that I could use the wrist detection feature which automatically locks the watch. However, there is no public API to access the lock or wrist state.

Then, I thought that using the WatchConnectivity framework I could use the activationState and listen for changes. I was hopping, that the state changes, when the user puts off the watch, but it doesn't.

Using HealthKit and listening for heart rates might help, but it requires a WorkoutSession and the HealthKit shall only be used by health or workout apps, which my app isn't.

the accelerometer does not reliably detect if the watch is worn on users wrist or just in his hand.

I was wondering if there is any API which will stop working whenever the watch gets locked. Is there a chance to get that information somehow?

来源:https://stackoverflow.com/questions/50927721/apple-watch-detect-if-watch-is-locked

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!