Looking for a simple answer. I am going to build an application that needs accelerometer data from the user's Watch.
My question is: For the iPhone to retrieve accelerometer data from the user's Watch, do I need to build a Watch app also? I believe the answer is No, as I found another SO question/answer stating that you can read Heart Rate data every 5 minutes without a Watch App. Here's the link for reference:
Read Heart Rate in Apple Watch Series 3 without creating an app on the Watch
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:
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.