קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
ממשקי Google Fit API ל-Android הם חלק משירותי Google Play. ממשקי Google Fit API נתמכים ב-Android 4.1 (רמת API 16) ואילך. באמצעות ממשקי ה-API האלה, האפליקציה יכולה לבצע את הפעולות הבאות:
קריאת נתונים כמעט בזמן אמת ונתונים היסטוריים, כולל נתונים ממכשירי Bluetooth עם צריכת אנרגיה נמוכה (BLE).
הקלטת פעילויות.
משייכים נתונים לסשן.
קבעו יעדי כושר.
קריאת נתוני חיישנים
אם האפליקציה שלך מספקת מידע על פעילות המשתמש, כמו הצעדים היומיים שלו, היא יכולה לעזור להציג נתונים כמעט בזמן אמת לגבי התנועות שלו.
באמצעות Sensors API תוכלו לקבל גישה למקורות של נתונים גולמיים שמכילים את המידע הזה. הנתונים יכולים להגיע מחיישנים שזמינים במכשיר שמופעל באמצעות Android, וגם מחיישנים במכשירים נלווים, כמו גאדג'טים לבישים.
תיעוד נתונים
אם האפליקציה שלכם צריכה לאסוף, לאחסן ולסנכרן נתונים לגבי הפעילות הפיזית של המשתמש, תוכלו להשתמש ב-Recording API. ה-API הזה מאחסן נתוני בריאות וכושר באמצעות המינויים. האפליקציה שלכם מציינת סוג אחד או יותר של פעילויות לתיעוד. לאחר מכן, אפליקציית Google Fit שומרת נתונים מהסוגים שצוינו ברקע, גם כשהאפליקציה לא פועלת. בנוסף, המינויים האלה ישוחזרו כשהמערכת תופעל מחדש.
איור 1. Google Fit ב-Android.
נתונים היסטוריים
אם רוצים לאפשר למשתמשים לראות נתוני כושר מפעילויות קודמות, אפשר להשתמש ב-History API. ה-API הזה מספק גישה לנתוני הבריאות ואיכות החיים ההיסטוריים, ומאפשר לאפליקציות לבצע פעולות בכמות גדולה כמו הוספה, מחיקה וקריאה של נתונים.
סשנים
נתוני כושר יכולים להועיל כשלעצמם, אבל הנתונים שימושיים יותר כשמשלבים אותם עם מידע נוסף על פעילות המשתמש. ה-Sessions API מקבץ נתוני בריאות ואיכות חיים יחד עם מטא-נתונים מסוימים, ביחידות שנקראות sessions. סשנים מייצגים מרווח זמן שבו המשתמש מבצע פעילות כושר.
הצגה והגדרה של יעדים
האפליקציה יכולה לעזור לך לעודד משתמשים על ידי השוואה בין פעילות הכושר שלהם לבין היעדים שהם הגדירו. בעזרת Goals API תוכלו להציג למשתמשים את יעדי הבריאות והכושר שהם יצרו.
[[["התוכן קל להבנה","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-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."]]