Using the various sensors on your device, Apple is able to predict if you are walking, running, in a vehicle, or stationary. This is all done quietly in the background by way of the motion coprocessor that is found in all iPhones since the 5s.
In this tutorial we will look at how your app can read that information, either live, or historically from the last 7 days. The CMMotionActivityManager has both the live updates using the startActivityUpdates: method, or the historical data with queryActivityStarting: both of which we will use. [Read more…]