To access the Apple Watch sensors, you will need an Apple Watch app
And due to limited background code execution capability on the Apple Watch, the user will have to explicitly interact with the app to start the sensors.
Basically, an iPhone app can access only it's own sensors. Same goes for an Apple Watch app.
There's no way right now in CMMotionManager
to tap into another device's sensors.
The reason heart rate is available is because of HealthKit
.
That data is sent to the iPhone periodically.
You are basically communicating with HealthKit
to get the latest heart rate, which... it recently got from the Apple Watch.
As for sensors, there's no central store that keeps the motion data of both devices.
Reasons probably being:
- It doesn't make much sense to store this data
- It's just too much data to sync!
- Motion is something that is expected for extreme responsiveness so the sensor data from Apple Watch would have to be sent to the iPhone, in worst case, atleast every second. That would be a massive battery hog!
Now this part is a hypothetical solution but sorry, it's not possible.
Your next challenge would be to create a placeholder Apple Watch App Extension whose sole task will be to receive a message from the iPhone, via WatchConnectivity
, to start it's sensors to get data, and send the samples back to the iPhone via WatchConnectivity
again.
Sadly, Apple Watch Apps are really limited when it comes to executing code in the background so nope.