Phone sensors
These pages are API references with the traps written in, not a buying guide. Which source should give a product its step count across HealthKit, Health Connect and wearable clouds is answered on the step counting API page. Tracking exercise with the camera instead of motion sensors is tracking workouts without a wearable, and building the app that runs on the wrist is watch apps.
iPhone, AirPods and Apple Watch: Core Motion
Steps with a seven-day memory, walking versus driving, a barometer for climbs, head motion from headphones, and high-rate batches for a swing.
- CMPedometer: steps, distance, floors and cadence from the phone itselfWhat CMPedometer returns, when fields are nil, why startUpdates totals are cumulative, the seven-day history limit and the NSMotionUsageDescription crash.UpdatedVerified October 3, 2026
- CMMotionActivityManager: walking, running, driving or stillHow CMMotionActivityManager reports walking, running, cycling, driving and stationary, why the flags overlap, what confidence means, and the 7-day limit.UpdatedVerified October 3, 2026
- CMAltimeter: relative and absolute altitude on iPhone and Apple WatchCMAltimeter's relative altitude restarts at zero on each start call; absolute altitude needs iOS 15 and, per Apple, iPhone 12 or Apple Watch 6 or SE.UpdatedVerified October 3, 2026
- CMHeadphoneMotionManager: head motion from AirPodsHow CMHeadphoneMotionManager streams head attitude from motion-capable Apple headphones, what Apple says about models, and connect and disconnect events.UpdatedVerified October 3, 2026
- CMBatchedSensorManager: high-frequency motion batches during workoutsWhat Apple documents about CMBatchedSensorManager: batched accelerometer and device motion during workouts, watchOS 10.0, and what it leaves out.UpdatedVerified October 3, 2026
Android: sensors and Play services
A since-boot step odometer that stops when you unregister, activity transitions delivered to a PendingIntent, and an accountless ten-day step recorder.
- Sensor.TYPE_STEP_COUNTER vs TYPE_STEP_DETECTOR on AndroidAndroid's step counter returns steps since the last reboot with up to 10 s latency; the step detector fires once per step. Permissions, batching, pitfalls.UpdatedVerified October 3, 2026
- The Activity Recognition Transition API and the ACTIVITY_RECOGNITION permissionSubscribing to walking, running, cycling, driving and still transitions on Android, the two ACTIVITY_RECOGNITION permissions, and silent failures.UpdatedVerified October 3, 2026
- The Recording API on mobile: steps without Health ConnectGoogle's Recording API on mobile records steps, distance and calories on-device with no Google Account, keeps 10 days, and replaces Google Fit on Android.UpdatedVerified October 3, 2026
Android: the permission and background rules around them
Keeping a workout alive with the screen off, and the Android 16 change that moved heart-rate access onto Health Connect's permissions.
- foregroundServiceType="health": permissions, prerequisites and exceptionsDeclaring a health foreground service on Android 14+: the manifest type, FOREGROUND_SERVICE_HEALTH, runtime prerequisites, and each exception it can throw.UpdatedVerified October 3, 2026
- Android 16: BODY_SENSORS gives way to android.permission.healthFor apps targeting Android 16, APIs that needed BODY_SENSORS now need android.permission.health permissions such as READ_HEART_RATE. What changed and why.UpdatedVerified October 3, 2026
Same job, both platforms
The closest documented counterpart on each side. They are not equivalents: history windows, permissions and delivery differ, and each page says how.
| Job | Apple | Android |
|---|---|---|
| Count steps | CMPedometer | Sensor.TYPE_STEP_COUNTER |
| Know whether the user is walking, running, cycling or driving | CMMotionActivityManager | Activity Recognition Transition API |
| Read recent step history | CMPedometer | Recording API on mobile |
Frequently asked questions
- Which motion APIs can a fitness app use on a phone with no wearable paired?
- On iPhone, Core Motion offers CMPedometer for steps, distance, floors, pace and cadence; CMMotionActivityManager for walking, running, cycling, driving or stationary; CMAltimeter for relative altitude, plus absolute altitude on the devices Apple names; and CMHeadphoneMotionManager for head motion from motion-capable Apple headphones. On Android, the platform has the TYPE_STEP_COUNTER and TYPE_STEP_DETECTOR sensors, and Google Play services adds the Activity Recognition Transition API and the Recording API on mobile. Which of these should supply a product's daily step total is a different question, answered on the step counting API page.
- What permission gates phone motion data on iOS and on Android?
- On iOS it is the NSMotionUsageDescription key in Info.plist; Apple says apps that call CMPedometer, CMMotionActivityManager or CMAltimeter without it crash, and each class reports the user's choice through authorizationStatus(). On Android it is android.permission.ACTIVITY_RECOGNITION, a dangerous runtime permission since API level 29, which Google documents for the step counter and step detector sensors, the Recording API on mobile and Play services activity recognition. Heart-rate sensors are a separate family, moving from BODY_SENSORS to android.permission.health permissions for apps targeting Android 16.
- How much motion history does each phone platform keep for an app to read?
- Apple says CMPedometer and CMMotionActivityManager keep seven days. Android's step counter sensor keeps none: it is a running total since the last reboot that only counts while something is registered. Google's Recording API on mobile keeps up to 10 days since the latest subscription, and the data becomes inaccessible if you unsubscribe. Apple's CMAltimeter page lists no history query at all. Anything older than those windows has to be stored by your own app or read from HealthKit or Health Connect.
Independent comparison, last reviewed October 3, 2026. Pricing, rate limits, and feature availability change often — confirm current details in each provider’s official documentation before you commit. Product and company names are trademarks of their respective owners; AIFitnessAPI is not affiliated with, endorsed by, or sponsored by any product listed here.