Skip to content
AF
Phone Sensors

Phone sensors

The phone a user already carries can count steps, tell walking from driving, measure a climb and, with AirPods in, follow their head, without a wearable. On iPhone that is Core Motion: CMPedometer, CMMotionActivityManager, CMAltimeter, CMHeadphoneMotionManager and CMBatchedSensorManager. On Android it is the step counter and step detector sensors, the Activity Recognition Transition API and the Recording API on mobile, wrapped in rules about runtime permissions and foreground services. Each page here covers one of those APIs by its exact name, with the documented limits that catch people out, such as Apple’s seven-day history window and Android’s since-reboot step total. Every claim comes from Apple’s or Google’s own documentation.

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.

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.

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.

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.

JobAppleAndroid
Count stepsCMPedometerSensor.TYPE_STEP_COUNTER
Know whether the user is walking, running, cycling or drivingCMMotionActivityManagerActivity Recognition Transition API
Read recent step historyCMPedometerRecording 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.

All 40 questions in Phone Sensors, answered

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.