Các API của Google Fit, bao gồm cả API Google Fit REST, sẽ ngừng hoạt động vào năm 2026. Kể từ ngày 1 tháng 5 năm 2024, nhà phát triển không thể đăng ký sử dụng các API này.
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Trang này chứa thông tin về các bản phát hành API Google Fit.
Nhật ký thay đổi liệt kê các bản phát hành theo ngày và bao gồm mọi tính năng mới, bản sửa lỗi hoặc điểm cải thiện đáng kể về hiệu suất.
Ngày 02/08/2021
Hiện tại, nhà phát triển có thể sử dụng rộng rãi tính năng ghi vào các loại dữ liệu sức khoẻ. Hoạt động uỷ quyền truy cập vào các loại dữ liệu Sức khoẻ nhất quán với mọi loại dữ liệu khác. Bạn có thể xem thêm thông tin tại đây.
Ngày 27 tháng 4 năm 2021
Việc thực thi những thay đổi về uỷ quyền được thông báo vào ngày 10 tháng 10 năm 2020 đã bị chậm trễ đôi chút. Những thay đổi về việc uỷ quyền sẽ được thực thi kể từ ngày 4 tháng 5 năm 2021.
Là một phần trong nỗ lực không ngừng nhằm tăng cường tính bảo mật và quyền riêng tư của Google Fit cho các nhà phát triển và người dùng, chúng tôi đã thực hiện một số thay đổi đối với các API và chính sách của Google Fit:
Giờ đây, quyền truy cập ghi sẽ chỉ cho phép ứng dụng đọc dữ liệu mà ứng dụng đã ghi. Để tiếp tục đọc dữ liệu do các ứng dụng khác ghi trên nền tảng Google Fit, hãy cập nhật mã của bạn để yêu cầu phạm vi truy cập đọc cho các loại dữ liệu có liên quan.
Dữ liệu nhịp tim có phạm vi riêng.
Dữ liệu giấc ngủ có phạm vi riêng và có một loại dữ liệu mới.
Bây giờ, khi làm việc với SessionsClient, bạn cần chỉ định loại phiên mà ứng dụng của bạn cần truy cập bằng các phương thức thích hợp từ FitnessOptions.
Các nhà phát triển có thể sử dụng những thay đổi này đối với API kể từ ngày 19 tháng 10 năm 2020. Việc thực thi sẽ bắt đầu từ ngày 27 tháng 4 năm 2021.
Hãy xem tại đây để biết thêm thông tin chi tiết và hướng dẫn về những thay đổi này.
Ngày 21 tháng 3 năm 2019
Ứng dụng Google Fit giờ đây hiển thị các phiên giấc ngủ được ghi vào API Android.
Tìm hiểu thêm về cách ghi và đọc dữ liệu giấc ngủ.
Ngày 19 tháng 11 năm 2018
API Google Fit đã có những thay đổi sau đây:
Yêu cầu đọc cho các kiểu dữ liệu com.google.location.sample và com.google.location.bounding_box sẽ chỉ trả về dữ liệu cho cùng một ứng dụng đã ghi dữ liệu.
Ngày 26 tháng 9 năm 2018
Phiên bản thể dục của Dịch vụ Google Play 16.0.0 cung cấp quyền truy cập vào hai loại dữ liệu mới và dữ liệu tổng hợp tương ứng:
Cập nhật Fitness API cho các ứng dụng mới dựa trên GoogleApi. Các ứng dụng này tự động quản lý các kết nối với các dịch vụ và yêu cầu ít mã nguyên mẫu hơn để sử dụng:
Thêm lớp BleClient và các phương thức Fitness.getBleClient(). BleClient cung cấp điểm truy cập để quét, xác nhận và sử dụng các thiết bị Bluetooth năng lượng thấp trong Google Fit.
Thêm lớp ConfigClient và các phương thức Fitness.getConfigClient(). ConfigClient cung cấp điểm truy cập để truy cập vào các chế độ cài đặt và loại dữ liệu tuỳ chỉnh trong Google Fit.
Thêm lớp GoalsClient và các phương thức Fitness.getGoalsClient(). GoalsClient cung cấp điểm truy cập để đọc dữ liệu thể dục Goal do người dùng Google Fit tạo.
Thêm lớp RecordingClient và các phương thức Fitness.getRecordingClient(). RecordingClient cung cấp điểm truy cập để bật tính năng thu thập dữ liệu cảm biến tiết kiệm pin và luôn bật ở chế độ nền trong Google Fit.
Thêm lớp SensorsClient và các phương thức Fitness.getSensorsClient(). SensorsClient cung cấp điểm truy cập để tiết lộ nhiều nguồn dữ liệu về hoạt động thể dục trong thiết bị cục bộ và thiết bị đã kết nối, đồng thời phân phối sự kiện trực tiếp cho người nghe.
Thêm lớp SessionsClient và các phương thức getSessionsClient. SessionsClient cung cấp điểm truy cập để tạo và quản lý Session hoạt động của người dùng trong Google Fit.
Bạn có thể xem các phép tính quãng đường đã đi và lượng calo đã sử dụng để tính toán gói thuê bao.
Nền tảng Fit bắt đầu theo dõi dữ liệu về quãng đường và lượng calo ngay khi một ứng dụng trên thiết bị đăng ký dữ liệu này. Để biết thêm thông tin về cách đăng ký các loại dữ liệu, hãy xem bài viết Ghi lại dữ liệu về hoạt động thể dục.
Dữ liệu không có sẵn theo thời gian thực thông qua API Cảm biến.
Giờ đây, nền tảng Fit có thể lưu trữ dữ liệu thói quen của hoạt động tập thể dục, chẳng hạn như cuộn bắp tay và động tác ngồi xuống, với loại dữ liệu com.google.activity.exercise. Để biết thêm thông tin về các bài tập mà Fit có thể lưu trữ, hãy xem WorkoutExercises.
Giờ đây, nền tảng Fit có thể theo dõi dữ liệu dinh dưỡng bằng loại dữ liệu com.google.fitness.
Loại dữ liệu com.google.calories.consumed hiện không còn được dùng nữa. Bạn có thể ghi lại mức tiêu thụ calo bằng loại dữ liệu com.google.fitness.item.
Nhà phát triển có thể truy xuất số bước tổng hợp hằng ngày để sử dụng trong một số khu vực như mặt đồng hồ Android Wear. Để biết thêm thông tin, hãy xem phần Đọc dữ liệu tổng hằng ngày.
API Google Fit hiện đã được mô-đun hoá để bạn có thể chọn tính năng để đưa vào ứng dụng của mình. Thay đổi này giúp giảm đáng kể nhu cầu về bộ nhớ đối với các ứng dụng hỗ trợ Google Fit và ảnh hưởng đến cách bạn truy cập vào các API. Để biết thêm thông tin về cách cập nhật mã của bạn, hãy xem phần Kết nối với dịch vụ thể dục.
Nền tảng Fit hiện sẽ tính toán khoảng cách. Để truy cập vào dữ liệu, hãy sử dụng kiểu dữ liệu com.google.distance.delta. Để biết thêm thông tin về các loại dữ liệu, hãy xem bài viết Các loại dữ liệu hoạt động thể dục.
Giờ đây, nhà phát triển có thể đọc và ghi dữ liệu chi tiết về giấc ngủ.
Bao gồm giấc ngủ chập chờn, giấc ngủ sâu, ngủ mắt chuyển động nhanh (REM) và hoạt động tỉnh giấc. Các loại hoạt động chi tiết này đã được thêm vào loại liệt kê FitnessActivities.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["\u003cp\u003eThis page lists Google Fit API releases, including new features, bug fixes, and performance improvements.\u003c/p\u003e\n"],["\u003cp\u003eThe Google Fit API has undergone authorization changes, including new data types and scopes for heart rate and sleep data.\u003c/p\u003e\n"],["\u003cp\u003eStarting May 4, 2021, Google Fit authorization changes went into effect, along with the Google Fit Developer and User Data Policy, and app verification began.\u003c/p\u003e\n"],["\u003cp\u003eWriting to Health data types became generally available on August 2, 2021, with authorization consistent with other data types.\u003c/p\u003e\n"],["\u003cp\u003eThe Google Fit API introduced GoogleApi-based clients in November 2017, automatically managing service connections and offering new features like BLE device support and custom data type access.\u003c/p\u003e\n"]]],[],null,["This page contains information about Google Fit API releases.\nThe changelog lists releases by date and includes any new\nfeatures, bug fixes or significant performance improvements.\n\nAugust 2, 2021\n\nWriting to [Health data types](/fit/datatypes/health) is now generally available\nto developers. Authorization to access Health data types is consistent with all\nother data types. More details [here](/fit/datatypes#authorization_scopes).\n\nApril 27, 2021\n\nThere has been a small delay to enforcement of the [authorization changes](/fit/improvements#what_are_the_authorization_changes)\nannounced on October 10, 2020. The authorization changes will now be enforced\nfrom May 4, 2021.\n\nThe [Google Fit Developer and User Data Policy](/fit/policy) will also become\nenforceable on May 4, 2021. [App verification](/fit/improvements#strengthening_the_review_system_for_apps_using_google_fit)\n, as part of enforcement of the Fit developer policy, will start start in due\ncourse.\n\nOctober 19, 2020\n\nAs part of our ongoing efforts to enhance the security and privacy of Google Fit\nfor developers and users, we've made some changes to the Google Fit policies and\nAPIs:\n\n- There is a new [Google Fit Developer and User Data Policy](/fit/policy). Please review the policy, and if relevant, make appropriate changes to your apps and services.\n- Write-access will now only let an app read data it has written. To continue reading data written by *other apps* from the Google Fit platform, update your code to request read-access scopes for the relevant data types.\n- Heart rate data has its own scopes.\n- Sleep data has its own scopes and a new data type.\n- When working with the `SessionsClient`, you now need to specify what type of session your app needs to access, using the appropriate methods from `FitnessOptions`.\n\nThese changes to the API will be available for developers to use from 19 October\n2020. Enforcement will start from 27 April 2021.\n\nSee [here](/fit/improvements) for more details and instructions on these\nchanges.\n\nMarch 21, 2019\n\nThe Google Fit app now displays sleep sessions written to the Android API.\nLearn more about [writing](/fit/scenarios/write-sleep-data) and [reading](/fit/scenarios/read-sleep-data) sleep data.\n\nNovember 19, 2018\n\nThe following changes have been made to the Google Fit API:\n\n- Read requests for datatypes `com.google.location.sample` and `com.google.location.bounding_box` will only return data for the same app that has written the data.\n\nSeptember 26, 2018\n\nGoogle Play services fitness 16.0.0 provides access to two new data types and\ntheir respective aggregates:\n\n- [`TYPE_HEART_POINTS`](/android/reference/com/google/android/gms/fitness/data/DataType#TYPE_HEART_POINTS)\n- [`AGGREGATE_HEART_POINTS`](/android/reference/com/google/android/gms/fitness/data/DataType#AGGREGATE_HEART_POINTS)\n- [`TYPE_MOVE_MINUTES`](/android/reference/com/google/android/gms/fitness/data/DataType#TYPE_MOVE_MINUTES)\n- [`AGGREGATE_MOVE_MINUTES`](/android/reference/com/google/android/gms/fitness/data/DataType#AGGREGATE_MOVE_MINUTES)\n\nArtifacts released on maven.google.com\n\n- com.google.android.gms:play-services-fitness:16.0.0\n\nNovember 2017\n\n[Google Play services 11.6.0](//developer.android.com/google/play-services/index.html)\nintroduces the following new Google Fit features:\n\n- Updated the Fitness API for the new [`GoogleApi`](/android/reference/com/google/android/gms/common/api/GoogleApi)-based clients, which automatically manage connections to services and require less boilerplate code to use:\n - Added the [`BleClient`](/android/reference/com/google/android/gms/fitness/BleClient) class and the [`Fitness.getBleClient()`](/android/reference/com/google/android/gms/fitness/Fitness#getBleClient(android.app.Activity,%20com.google.android.gms.auth.api.signin.GoogleSignInAccount)) methods. `BleClient` provides the entry point for scanning, claiming, and using Bluetooth Low Energy devices in Google Fit.\n - Added the [`ConfigClient`](/android/reference/com/google/android/gms/fitness/ConfigClient) class and the [`Fitness.getConfigClient()`](/android/reference/com/google/android/gms/fitness/Fitness#getConfigClient(android.content.Context,%20com.google.android.gms.auth.api.signin.GoogleSignInAccount)) methods. `ConfigClient` provides the entry point for accessing custom data types and settings in Google Fit.\n - Added the [`GoalsClient`](/android/reference/com/google/android/gms/fitness/GoalsClient) class and the [`Fitness.getGoalsClient()`](/android/reference/com/google/android/gms/fitness/Fitness#getGoalsClient(android.content.Context,%20com.google.android.gms.auth.api.signin.GoogleSignInAccount)) methods. `GoalsClient` provides the entry point for reading fitness [`Goal`](/android/reference/com/google/android/gms/fitness/data/Goal)s created by users in Google Fit.\n - Added the [`HistoryClient`](/android/reference/com/google/android/gms/fitness/HistoryClient) class and the [`Fitness.getHistoryClient()`](/android/reference/com/google/android/gms/fitness/Fitness#getHistoryClient(android.content.Context,%20com.google.android.gms.auth.api.signin.GoogleSignInAccount)) methods. `HistoryClient` provides the entry point for inserting, deleting, and reading data in Google Fit.\n - Added the [`RecordingClient`](/android/reference/com/google/android/gms/fitness/RecordingClient) class and the [`Fitness.getRecordingClient()`](/android/reference/com/google/android/gms/fitness/Fitness#getRecordingClient(android.content.Context,%20com.google.android.gms.auth.api.signin.GoogleSignInAccount)) methods. `RecordingClient` provides the entry point for enabling low-power, always-on background collection of sensor data in Google Fit.\n - Added the [`SensorsClient`](/android/reference/com/google/android/gms/fitness/SensorsClient) class and the [`Fitness.getSensorsClient()`](/android/reference/com/google/android/gms/fitness/Fitness#getSensorsClient(android.content.Context,%20com.google.android.gms.auth.api.signin.GoogleSignInAccount)) methods. `SensorsClient` provides the entry point for exposing different sources of fitness data in local and connected devices, and delivering live events to listeners.\n - Added the [`SessionsClient`](/android/reference/com/google/android/gms/fitness/SessionsClient) class and the [`getSessionsClient`](/android/reference/com/google/android/gms/fitness/Fitness#getSessionsClient(android.content.Context,%20com.google.android.gms.auth.api.signin.GoogleSignInAccount)) methods. `SessionsClient` provides the entry point for creating and managing [`Session`](/android/reference/com/google/android/gms/fitness/data/Session)s of user activity in Google Fit.\n\nMay 2015\n\n[Google Play services 7.5](//developer.android.com/google/play-services/index.html)\nintroduces the following new Google Fit features:\n\n- Distance traveled and calories expended computations are available for subscription.\n - The Fit platform starts tracking distance and calorie data as soon as an app on the device subscribes to the data. For more information on how to subscribe to data types, see [Record Fitness Data](/fit/android/record).\n - The data is not available in real-time with the [Sensors API](/fit/android/sensors).\n- The Fit platform can now store exercise routine data, such as bicep curls and squats, with the `com.google.activity.exercise` data type. For more information on the exercises Fit can store, see [`WorkoutExercises`](/android-gcore/reference/com/google/android/gms/fitness/data/WorkoutExercises).\n\nApril 2015\n\n[Google Play services 7.3](//developer.android.com/google/play-services/index.html)\nintroduces the following new Google Fit features:\n\n- The Fit platform can now track nutrition data with the `com.google.fitness` data type.\n - The `com.google.calories.consumed` data type is now deprecated. Calorie consumption can be recorded with the `com.google.fitness.item` data type.\n - For more information on data types, see [Fitness Data Types](/fit/android/data-types).\n- Developers can retrieve daily aggregate step counts for use in areas such as Android Wear watch faces. For more information, see [Read daily total data](/fit/android/history#read_daily_total_data).\n\nMarch 2015\n\n[Google Play services 7.0](//developer.android.com/google/play-services/index.html)\nintroduces the following new Google Fit features:\n\n- The Google Fit API is now modularized so that you can choose which features to include in your app. This change significantly reduces the memory requirement for apps that enable Google Fit and affects how you access the APIs. For more information on how to update your code, see [Connect to the fitness service](/fit/android/get-started#step_5_connect_to_the_fitness_service).\n- The Fit platform now calculates distance. To access the data, use the `com.google.distance.delta` data type. For more information on data types, see [Fitness Data Types](/fit/android/data-types).\n- Developers can now read and write granular sleep data. This includes light sleep, deep sleep, REM, and awake activities. These granular activity types have been added to the [`FitnessActivities`](/android/reference/com/google/android/gms/fitness/FitnessActivities) enumerated type.\n - To insert sleep data, create a session of type [`FitnessActivities.SLEEP`](/android/reference/com/google/android/gms/fitness/FitnessActivities#SLEEP).\n - To detect granularity in your session, insert activity segments of types:\n - [`FitnessActivities.SLEEP_LIGHT`](/android/reference/com/google/android/gms/fitness/FitnessActivities#SLEEP_LIGHT)\n - [`FitnessActivities.SLEEP_DEEP`](/android/reference/com/google/android/gms/fitness/FitnessActivities#SLEEP_DEEP)\n - [`FitnessActivities.SLEEP_REM`](/android/reference/com/google/android/gms/fitness/FitnessActivities#SLEEP_REM)\n - [`FitnessActivities.SLEEP_AWAKE`](/android/reference/com/google/android/gms/fitness/FitnessActivities#SLEEP_AWAKE)\n - To read sleep data, query the sleep sessions for sleep activity segments as you would do with normal fitness activities."]]