Skip to content
AF
Phone Sensors

The Recording API on mobile: steps without Health Connect

Last verified October 3, 2026 · 3 min read

The Recording API on mobile is a Google Play services API that records fitness data from the phone in a battery-efficient way, with no Google Account, storing the data on the device. It records three data types, TYPE_STEP_COUNT_DELTA, TYPE_DISTANCE_DELTA and TYPE_CALORIES_EXPENDED, once your app subscribes, needs the android.permission.ACTIVITY_RECOGNITION permission, and makes up to 10 days of data since the latest subscription available. Google describes it as a replacement for the Google Fit Android API, and points apps that need health data from many sources to Health Connect instead.

Covered here:Health Connect

For an Android app that wants a week of steps without asking users to install or configure anything, and without reading raw sensors itself, this is Google's answer. Everything here is from Google's Recording API guide, read 2026-10-03. The LocalRecordingClient reference is hosted on developers.google.com, which our research environment could not reach, so claims below come from the guide only.

What it is, in Google's words#

"The Recording API on mobile allows your app to record fitness data from a mobile device in a battery-efficient way. For example, use this API to record steps, similar to a pedometer retrieving step count data. This API is accountless, meaning it does not require a Google Account to use the service, and data is stored on-device."

And its relationship to the old API: "The Recording API on mobile is a replacement for the Google Fit Android API, which is being deprecated." The page also carries a banner: "Google Fit APIs will be supported until the end of 2026." The wider shutdown is tracked on the Google Fit shutdown page.

The rules that shape your design#

RuleGoogle's wording
Data typesTYPE_STEP_COUNT_DELTA, TYPE_DISTANCE_DELTA, TYPE_CALORIES_EXPENDED
Retention"data since the latest subscription - for up to 10 days - is accessible"
Subscription"Data is only available when there is an active subscription"
Unsubscribe"If a subscription is removed by calling unsubscribe, collected data won't be accessible."
Permissionandroid.permission.ACTIVITY_RECOGNITION
Play servicesMust be at least LOCAL_RECORDING_CLIENT_MIN_VERSION_CODE

Ten days is a rolling buffer, not storage. Google's advice: "To reduce the risk of losing data, you can use WorkManager to periodically collect the data in the background."

Subscribe, then read#

Google's guide shows the dependency as com.google.android.gms:play-services-fitness:21.2.0; check for a newer version when you add it. The flow, trimmed from Google's samples:

// 1. Play services must be new enough (Google's guide calls this unqualified).
val ok = isGooglePlayServicesAvailable(context, LocalRecordingClient.LOCAL_RECORDING_CLIENT_MIN_VERSION_CODE)
if (ok != ConnectionResult.SUCCESS) return  // prompt the user to update Google Play services

// 2. Subscribe once; recording continues in the background.
val client = FitnessLocal.getLocalRecordingClient(context)
client.subscribe(LocalDataType.TYPE_STEP_COUNT_DELTA)

// 3. Read daily totals for the past week.
val end = LocalDateTime.now().atZone(ZoneId.systemDefault())
val request = LocalDataReadRequest.Builder()
    .aggregate(LocalDataType.TYPE_STEP_COUNT_DELTA)
    .bucketByTime(1, TimeUnit.DAYS)
    .setTimeRange(end.minusWeeks(1).toEpochSecond(), end.toEpochSecond(), TimeUnit.SECONDS)
    .build()
client.readData(request).addOnSuccessListener { response ->
    for (dataSet in response.buckets.flatMap { it.dataSets }) {
        for (point in dataSet.dataPoints) { /* one bucket's steps */ }
    }
}

Two details from the guide. On an old Play services version, Google says "the system throws a ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED exception", which is how the guide words a status code, so check the result before calling anything else. And "The LocalRecordingClient continuously updates its collection of data. You can use readData to pull the latest numbers at any time."

Recording API or Health Connect#

This page does not answer that across the board; the step counting API page does. The Recording API guide's own position: "If your app needs to read other health and fitness data from various sources in addition to on-device steps, integrating with Health Connect is a better option. Health Connect also provides access to on-device steps natively on Android 14 (API level 34) and higher." Moving an existing Google Fit integration is covered in the Google Fit to Health Connect migration guide.

Pitfalls#

  • Unsubscribing as cleanup. Google says collected data won't be accessible after you unsubscribe. Unsubscribe only when the feature is genuinely off.
  • Reading once a fortnight. Data older than 10 days since the latest subscription is gone. Schedule periodic reads.
  • Skipping the version check. Old Play services fail the calls.
  • Forgetting the runtime permission. ACTIVITY_RECOGNITION is a dangerous permission on Android 10 and higher.
  • Expecting server sync. The data is on-device and accountless. Your backend sees it only if your app uploads it.
  • Expecting other metrics. The guide lists three data types. Heart rate and workouts are Health Connect's territory.

If you would rather own the counting yourself, the raw sensor is covered on Sensor.TYPE_STEP_COUNTER.

Frequently asked questions

Does the Recording API on mobile need a Google Account?
No. Google's Recording API guide describes it as accountless, meaning it does not require a Google Account to use the service, and says the data is stored on-device. That is a deliberate difference from the Google Fit APIs it replaces. The trade-off is that nothing syncs to the cloud on its own; if your service needs the numbers server-side, your app has to read them and upload them itself.
How many days of step data does the Recording API keep?
Up to 10 days. Google's guide says that once the recording subscription starts or is renewed, data since the latest subscription, for up to 10 days, is accessible, and that the LocalRecordingClient stores up to 10 days of data. Google suggests using WorkManager to collect the data periodically in the background to reduce the risk of losing it, which in practice means reading and persisting daily totals well inside that window.
What happens to recorded steps if I unsubscribe from the Recording API?
You lose access to them. Google's guide says data is only available when there is an active subscription, and that if a subscription is removed by calling unsubscribe, collected data won't be accessible. Read and store anything you want to keep before unsubscribing, and do not unsubscribe as routine cleanup on logout or screen exit if you expect to show history later.
Should I use the Recording API or Health Connect for Android steps?
Google's Recording API guide frames it this way: if your app needs other health and fitness data from various sources in addition to on-device steps, Health Connect is the better option, and Health Connect also provides on-device steps natively on Android 14 and higher. The Recording API suits an app that only needs recent on-device steps, distance or calories without an account. The cross-provider decision is covered on our step counting API page.

All 40 questions in Phone Sensors →

Keep reading

Elsewhere on the site

Pages that share this one’s concepts and sources, from other sections.

Next steps

Was this page useful?

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.

← All phone sensors · by AIFitnessAPI