问题
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