Las APIs de Google Fit, incluida la API de REST de Google Fit, dejarán de estar disponibles en 2026. A partir del 1 de mayo de 2024, los desarrolladores no podrán registrarse para usar estas APIs.
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Las APIs de Google Fit para Android forman parte de los Servicios de Google Play. Las APIs de Google Fit son compatibles con Android 4.1 (nivel de API 16) y versiones posteriores. Con estas APIs, tu app puede hacer lo siguiente:
Leer datos históricos y casi en tiempo real, incluidos los datos de dispositivos Bluetooth de bajo consumo (BLE).
Registra las actividades.
Asocia datos a una sesión.
Establece objetivos de entrenamiento.
Cómo leer los datos del sensor
Si tu app proporciona información sobre la actividad de un usuario, como sus pasos diarios, puede resultar útil mostrar datos casi en tiempo real sobre los movimientos del usuario.
La API de Sensors proporciona acceso a flujos de datos sin procesar que contienen esta información. Los datos pueden provenir de sensores disponibles en el dispositivo con Android y de sensores en dispositivos complementarios, como wearables.
Registra datos
Si tu app necesita recopilar, almacenar y sincronizar datos sobre la actividad física de un usuario, puedes usar la API de Recording. Esta API almacena datos de salud y bienestar a través de suscripciones. Tu app especifica uno o más tipos de actividades para registrar. Luego, Google Fit almacenará datos de los tipos especificados en segundo plano, incluso cuando no se esté ejecutando la app. También restablece estas suscripciones cuando se reinicia el sistema.
Figura 1: Google Fit en Android
Datos históricos
Si quieres que los usuarios puedan ver los datos de entrenamiento de actividades anteriores, puedes usar la API de History. Esta API proporciona acceso a los datos históricos de salud y bienestar, y permite que las apps realicen operaciones masivas, como insertar, borrar y leer datos.
Sesiones
Los datos de actividad física pueden ser beneficiosos por sí solos, pero son más útiles cuando los combinas con información adicional sobre la actividad del usuario. La API de Sessions agrupa datos de salud y bienestar, junto con algunos metadatos, en unidades denominadas sesiones. Las sesiones representan un intervalo de tiempo durante el cual el usuario realiza una actividad física.
Cómo ver y establecer objetivos
Tu app puede ayudar a motivar a los usuarios, ya que les muestra cómo se compara su actividad física con los objetivos que establecieron. La API de Goals ayuda a tu
app a mostrar a los usuarios los objetivos de salud y fitness que crearon.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-31 (UTC)"],[[["\u003cp\u003eThe Google Fit APIs let your Android app read, record, and store fitness and wellness data from various sources, including BLE devices.\u003c/p\u003e\n"],["\u003cp\u003eApps can use the Recording API to continuously track user activity in the background, even when the app isn't actively running.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can access and manage historical fitness data, enabling users to view past activities and trends through the History API.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Fit allows data to be grouped into sessions, providing context and insights into specific user activities with the Sessions API.\u003c/p\u003e\n"],["\u003cp\u003eApps can leverage the Goals API to display and manage user fitness goals, promoting engagement and motivation.\u003c/p\u003e\n"]]],[],null,["# Android APIs\n\nThe Google Fit APIs for Android are part of [Google Play\nservices](/android/guides/overview). The Google Fit APIs are supported on\nAndroid 4.1 (API level 16) and higher. Using these APIs, your app can do the\nfollowing:\n\n- Read near-real-time and historic data, including data from Bluetooth Low Energy (BLE) devices.\n- Record activities.\n- Associate data with a session.\n- Set fitness goals.\n\nRead sensor data\n----------------\n\nIf your app provides information about a user's activity, such as their daily\nsteps, it can be helpful to show near-real-time data about the user's movements.\nThe [Sensors API](/fit/android/sensors) provides access to streams of raw data\nthat contain this information. The data can come from sensors available on the\nAndroid-powered device as well as from sensors in companion devices, such as\nwearables.\n\nRecord data\n-----------\n\nIf your app needs to gather, store, and sync data about a user's physical\nactivity, you can use the [Recording API](/fit/android/record). This API stores\nhealth and wellness data using subscriptions. Your app specifies one or more\ntypes of activities to record. Google Fit then stores data of the\nspecified types in the background even when your app isn't running. It also\nrestores these subscriptions when the system is restarted. \n**Figure 1.** Google Fit on Android.\n\nHistorical data\n---------------\n\nIf you want users to be able to view fitness data from past activities, you can\nuse the [History API](/fit/android/history). This API provides access to the\nhistorical health and wellness data and lets apps perform bulk operations, such\nas inserting, deleting, and reading data.\n\nSessions\n--------\n\nFitness data can be beneficial by itself, but the data is more useful when you\ncombine it with additional information about the user's activity. The [Sessions\nAPI](/fit/android/using-sessions) bundles health and wellness data, along with\nsome metadata, into units called *sessions*. Sessions represent a time interval\nduring which the user performs a fitness activity.\n\nView and set goals\n------------------\n\nYour app can help motivate users by showing how their fitness activity compares\nto the goals that they've set. The [Goals API](/fit/android/goals) helps your\napp show users the health and fitness goals that they've created."]]