דוגמאות קוד ל-Android
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
מאגר Google Fit ב-GitHub כולל דוגמאות קוד שמסבירות איך להשתמש בממשקי ה-API של Android. במדריך למפתחים תוכלו למצוא גם קטעי קוד למשימות נפוצות אחרות.
קריאת נתונים מחיישנים
דוגמת קוד GitHub לרישום מאזינים לקריאת נתוני חיישנים גולמיים ממקור נתונים.
תיעוד נתונים באחסון של Fit
דוגמת קוד GitHub לבקשת אחסון אוטומטי של נתוני חיישנים על ידי יצירת מינויים.
קריאת נתונים מ-Google Fit
דוגמת קוד GitHub לקריאת נתונים מהיסטוריית הכושר של המשתמש.
עבודה עם ביקורים
דוגמת קוד של GitHub להדגמת סשנים: צמצו נתוני כושר כסשן לוגי, לייצוג אימון כולל.
מונה צעדים
דוגמת קוד GitHub לתיעוד שלבים ולקרוא אותם.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-31 (שעון UTC).
[null,null,["עדכון אחרון: 2025-08-31 (שעון UTC)."],[[["\u003cp\u003eThe Google Fit repository on GitHub provides code samples demonstrating how to use Android APIs for fitness data.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can find code snippets for common tasks like reading sensor data, recording data, working with sessions, and utilizing the step counter, within the Google Fit repository and developer guide.\u003c/p\u003e\n"],["\u003cp\u003eAccess various GitHub code samples to learn about registering sensor listeners, requesting automated data storage, reading fitness history, and implementing sessions in your fitness applications.\u003c/p\u003e\n"]]],[],null,["# Android code samples\n\nThe [Google Fit repo on GitHub](https://github.com/android/fit) has code samples\nexplaining how to use the Android APIs. There are also code snippets for other\ncommon tasks in the [developer guide](/fit/android).\n\n### Read data from sensors\n\n[GitHub code sample to register listeners](https://github.com/android/fit-samples/tree/master/BasicSensorsApiKotlin)\nto read raw sensor data from a data source.\n\n### Record data to Fit storage\n\n[GitHub code sample to request automated storage of sensor data](https://github.com/android/fit-samples/tree/master/BasicRecordingApiKotlin)\nby creating subscriptions.\n\n### Read data from Google Fit\n\n[GitHub code sample to read data from the user's fitness history](https://github.com/android/fit-samples/tree/master/BasicHistoryApiKotlin).\n\n### Work with sessions\n\n[GitHub code sample to demonstrate sessions](https://github.com/android/fit-samples/tree/master/BasicHistorySessionsKotlin):\nEncapsulate fitness data as a logical [session](/fit/android/using-sessions),\nto represent an overall workout.\n\n### Step counter\n\n[GitHub code sample to record steps and read them back](https://github.com/android/fit-samples/tree/master/StepCounterKotlin)."]]