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.
Google Fit là một hệ sinh thái mở. Thư viện này cho phép nhà phát triển tải dữ liệu sức khoẻ thể chất và tinh thần lên một kho lưu trữ trung tâm, nơi người dùng có thể truy cập vào dữ liệu của họ từ nhiều thiết bị và ứng dụng ở một vị trí. Họ vẫn có thể truy cập vào dữ liệu của mình nếu nâng cấp lên thiết bị mới.
Ứng dụng sức khoẻ thể chất và tinh thần của bạn có thể lưu trữ dữ liệu từ bất kỳ thiết bị đeo hoặc cảm biến nào, đồng thời truy cập vào dữ liệu do các ứng dụng khác tạo ra.
Một kho lưu trữ trung tâm lưu trữ dữ liệu từ nhiều thiết bị và ứng dụng. Cửa hàng thể dục là một dịch vụ đám mây minh bạch với khách hàng.
Khung cảm biến
Một tập hợp các biểu tượng cấp cao giúp bạn dễ dàng làm việc với cửa hàng thể dục. Bạn sử dụng các cách biểu diễn này với API Google Fit.
Quyền và các chế độ kiểm soát của người dùng
Một nhóm phạm vi uỷ quyền để yêu cầu người dùng cho phép làm việc với dữ liệu sức khoẻ thể chất và tinh thần. Google Fit cần có sự đồng ý của người dùng thì mới truy cập được dữ liệu về sức khoẻ thể chất và tinh thần.
API Google Fit
API Android và REST để truy cập vào kho dữ liệu thể dục. Bạn có thể tạo các ứng dụng hỗ trợ Google Fit trên nhiều nền tảng và thiết bị, chẳng hạn như Android, iOS và ứng dụng web.
Cửa hàng thể dục
Kho lưu trữ nội dung thể dục là một dịch vụ đám mây giúp duy trì dữ liệu sức khoẻ thể chất và tinh thần bằng cách sử dụng cơ sở hạ tầng của Google. Ứng dụng trên các nền tảng và thiết bị khác nhau có thể lưu trữ dữ liệu cũng như truy cập vào dữ liệu do các ứng dụng khác tạo ra. Google Fit cung cấp một bộ API giúp bạn dễ dàng chèn dữ liệu và truy vấn kho dữ liệu thể dục.
Khung cảm biến
Khung cảm biến xác định các cách biểu diễn cấp cao cho cảm biến, loại dữ liệu, điểm dữ liệu và phiên. Các biểu đồ này giúp bạn dễ dàng làm việc với cửa hàng thể dục trên mọi nền tảng.
Nguồn dữ liệu
Nguồn dữ liệu biểu thị cảm biến và bao gồm tên, loại dữ liệu được thu thập và các thông tin chi tiết khác về cảm biến. Nguồn dữ liệu có thể đại diện cho cảm biến phần cứng hoặc cảm biến phần mềm. Bạn có thể xác định cảm biến phần mềm trong ứng dụng của mình.
Kiểu dữ liệu
Các loại dữ liệu biểu thị nhiều loại dữ liệu về sức khoẻ thể chất và tinh thần, chẳng hạn như số bước hoặc nhịp tim. Các loại dữ liệu thiết lập một giản đồ mà qua đó các ứng dụng có thể hiểu dữ liệu của nhau. Mỗi loại dữ liệu bao gồm tên và danh sách các trường được sắp xếp theo thứ tự, trong đó mỗi trường đại diện cho một phương diện. Ví dụ: loại dữ liệu cho vị trí chứa 3 trường (vĩ độ, kinh độ và độ chính xác), trong khi loại dữ liệu cho trọng lượng chỉ chứa một trường.
Điểm dữ liệu
Điểm dữ liệu bao gồm một mảng các giá trị có dấu thời gian của một loại dữ liệu, được đọc từ một nguồn dữ liệu. Bạn sử dụng các điểm dữ liệu để ghi lại và chèn dữ liệu về sức khoẻ thể chất và tinh thần vào kho lưu trữ thể dục, cũng như để đọc dữ liệu thô từ một nguồn dữ liệu. Các điểm chứa thời gian bắt đầu đại diện cho một khoảng thời gian thay vì chỉ số đọc tức thời.
Tập dữ liệu
Các tập dữ liệu đại diện cho một tập hợp các điểm dữ liệu cùng loại từ một nguồn dữ liệu cụ thể trong một khoảng thời gian nào đó. Bạn sẽ sử dụng tập dữ liệu để chèn dữ liệu vào kho lưu trữ dữ liệu thể dục. Các truy vấn để đọc dữ liệu từ kho dữ liệu thể dục cũng trả về tập dữ liệu.
Phiên
Phiên hoạt động biểu thị khoảng thời gian người dùng thực hiện một hoạt động thể dục, chẳng hạn như chạy bộ, đạp xe, v.v. Phiên hoạt động giúp sắp xếp dữ liệu và thực hiện các truy vấn chi tiết hoặc tổng hợp trên kho lưu trữ hoạt động thể dục cho một hoạt động thể dục.
Quyền và các chế độ kiểm soát của người dùng
Google Fit cần có sự đồng ý của người dùng thì các ứng dụng mới có thể đọc hoặc lưu trữ dữ liệu sức khoẻ thể chất và tinh thần.
Google Fit xác định phạm vi OAuth liên kết với một số nhóm quyền có đặc quyền đọc và ghi riêng biệt: các loại dữ liệu liên quan đến hoạt động, cơ thể, vị trí, dinh dưỡng và sức khoẻ (các loại dữ liệu liên quan đến sức khoẻ được nhóm với độ chi tiết hơn). Mỗi nhóm quyền sẽ cấp cho ứng dụng quyền truy cập vào một nhóm loại dữ liệu.
Các ứng dụng sẽ chỉ định một hoặc nhiều phạm vi trong số này để làm việc với dữ liệu sức khoẻ thể chất và tinh thần. Sau đó, Google Fit sẽ yêu cầu người dùng cấp các quyền tương ứng.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-31 UTC."],[[["\u003cp\u003eGoogle Fit provides a central platform and APIs for storing, accessing, and sharing health and wellness data from various apps and devices.\u003c/p\u003e\n"],["\u003cp\u003eUsers have control over their data and must grant permission for apps to access it.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can build apps that integrate with Google Fit using Android or REST APIs, supporting cross-platform functionality.\u003c/p\u003e\n"],["\u003cp\u003eData is organized using data sources, data types, data points, datasets, and sessions for efficient storage and retrieval.\u003c/p\u003e\n"],["\u003cp\u003eCompliance with the Google Fit Developer and User Data Policy and Terms and Conditions is essential when utilizing the platform.\u003c/p\u003e\n"]]],[],null,["# Platform Overview\n\nGoogle Fit is an open ecosystem. It lets developers upload health and wellness\ndata to a central repository where users can access their data from different\ndevices and apps in one location. They can still access their data if they\nupgrade to a new device.\n\nYour health and wellness app can store data from any wearable or sensor, and\naccess data created by other apps.\n| **Note:** The Google Fit app uses the Google Fit platform, which is included in Google Play services. Your app can use this platform without needing users to install the Google Fit app.\n\nRead the [Google Fit Developer and User Data Policy](/fit/policy) thoroughly and\nmake sure your app complies with it. Carefully review the [Google Fit Terms and\nConditions](/fit/terms) before using Google Fit. By using the API, you agree to\nthe Google Fit Terms and Conditions.\n\nComponents\n----------\n\nGoogle Fit consists of the following components: \n**Figure 1** : Platform overview.\n\nThe fitness store\n: A central repository that stores data from a variety of devices and apps. The\n fitness store is a cloud service that is transparent to clients.\n\nThe sensor framework\n: A set of high-level representations that make it easy to work with the fitness\n store. You use these representations with the Google Fit APIs.\n\nPermissions and user controls\n: A set of authorization scopes to request user permission to work with health\n and wellness data. Google Fit requires user consent to access health and\n wellness data.\n\nGoogle Fit APIs\n: Android and REST APIs to access the fitness store. You can create apps that\n support Google Fit on multiple platforms and devices, such as Android, iOS, and\n Web apps.\n\nThe fitness store\n-----------------\n\nThe fitness store is a cloud service that persists health and wellness data using Google's\ninfrastructure. Apps on different platforms and devices can store data and\naccess data created by other apps. Google Fit provides a set of APIs that make\nit easy to insert data and query the fitness store.\n\nThe sensor framework\n--------------------\n\nThe sensor framework defines high-level representations for sensors,\ndata types, data points, and sessions. These representations make it easy to\nwork with the fitness store on any platform.\n\nData Sources\n: Data sources represent sensors and consist of a name, the type of data\n collected, and other sensor details. A data source may represent a hardware\n sensor or a software sensor. You can define software sensors in your apps.\n\nData Types\n: Data types represent different kinds of health and wellness data, like step count or heart\n rate. Data types establish a schema through which different apps can understand\n each other's data. A data type consists of a name and an ordered list of fields,\n where each field represents a dimension. For example, a data type for location\n contains three fields (latitude, longitude, and accuracy), whereas a data type\n for weight contains only one field.\n\nData Points\n: Data points consist of a timestamped array of values for a data type, read\n from a data source. You use data points to record and insert health and wellness data in the\n fitness store, and to read raw data from a data source. Points that contain a\n start time represent a time range instead of an instantaneous reading.\n\nDatasets\n: Datasets represent a set of data points of the same type from a particular\n data source covering some time interval. You use datasets to insert data into\n the fitness store. Queries to read data from the fitness store also return\n datasets.\n\nSessions\n: Sessions represent a time interval during which users perform a fitness\n activity, such as a run, a bike ride, and so on. Sessions help organize data and\n perform detailed or aggregate queries on the fitness store for a fitness\n activity.\n\nPermissions and user controls\n-----------------------------\n\nGoogle Fit requires user consent before apps can read or store health and wellness data.\nGoogle Fit defines OAuth scopes that map to a number of permission groups with\nseparate read and write privileges: activity, body, location, nutrition and\nhealth-related data types (health-related data types are grouped with finer\ngranularity). Each permission group grants apps access to a set of data types.\nApps specify one or more of these scopes to work with health and wellness data, and Google\nFit requests the corresponding permissions from the user.\n\nGoogle Fit APIs\n---------------\n\nGoogle Fit provides the following APIs:\n\n- [Android APIs](/fit/android) for Android apps.\n- [REST API](/fit/rest) for apps on any platform."]]