APIهای Google Fit، از جمله Google Fit REST API، در سال 2026 منسوخ خواهند شد . از 1 می 2024، توسعه دهندگان نمی توانند برای استفاده از این API ها ثبت نام کنند .
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
APIهای Google Fit برای Android بخشی از خدمات Google Play هستند. APIهای Google Fit در Android نسخه 4.1 (سطح API 16) و بالاتر پشتیبانی میشوند. با استفاده از این API ها، برنامه شما می تواند کارهای زیر را انجام دهد:
دادههای تقریباً واقعی و تاریخی، از جمله دادههای دستگاههای کمانرژی بلوتوث (BLE) را بخوانید.
ثبت فعالیت ها
داده ها را با یک جلسه مرتبط کنید.
اهداف تناسب اندام را تعیین کنید.
خواندن داده های حسگر
اگر برنامه شما اطلاعاتی درباره فعالیت کاربر، مانند گامهای روزانه او ارائه میکند، نشان دادن دادههای تقریباً واقعی در مورد حرکات کاربر میتواند مفید باشد. Sensors API دسترسی به جریانهای داده خام را فراهم میکند که حاوی این اطلاعات است. دادهها میتوانند از حسگرهای موجود در دستگاه مجهز به Android و همچنین از حسگرهای دستگاههای همراه، مانند پوشیدنیها به دست آیند.
داده ها را ثبت کنید
اگر برنامه شما نیاز به جمع آوری، ذخیره و همگام سازی داده های مربوط به فعالیت فیزیکی کاربر دارد، می توانید از Recording API استفاده کنید. این API داده های سلامت و تندرستی را با استفاده از اشتراک ها ذخیره می کند. برنامه شما یک یا چند نوع فعالیت را برای ضبط مشخص می کند. سپس Google Fit دادههای انواع مشخصشده را حتی زمانی که برنامه شما اجرا نمیشود در پسزمینه ذخیره میکند. همچنین با راه اندازی مجدد سیستم، این اشتراک ها را بازیابی می کند.
شکل 1. Google Fit در اندروید.
داده های تاریخی
اگر میخواهید کاربران بتوانند دادههای تناسب اندام را از فعالیتهای گذشته مشاهده کنند، میتوانید از History API استفاده کنید. این API دسترسی به دادههای سلامت و سلامتی را فراهم میکند و به برنامهها اجازه میدهد عملیاتهای انبوه، مانند درج، حذف، و خواندن دادهها را انجام دهند.
جلسات
داده های تناسب اندام به خودی خود می توانند مفید باشند، اما داده ها زمانی مفیدتر هستند که آنها را با اطلاعات اضافی درباره فعالیت کاربر ترکیب کنید. Sessions API دادههای سلامت و تندرستی را همراه با برخی فرادادهها در واحدهایی به نام Session دستهبندی میکند. جلسات بازه زمانی را نشان می دهد که در طی آن کاربر یک فعالیت تناسب اندام را انجام می دهد.
مشاهده و تعیین اهداف
برنامه شما میتواند با نشان دادن اینکه چگونه فعالیت تناسب اندام آنها با اهدافی که تعیین کردهاند مقایسه میکند، به انگیزه دادن به کاربران کمک کند. Goals API به برنامه شما کمک می کند تا اهداف سلامت و تناسب اندام را به کاربران نشان دهد.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\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,["The 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\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\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\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\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\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."]]