Android कोड सैंपल
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
GitHub पर Google Fit रेपो में कोड सैंपल हैं, जो Android एपीआई को इस्तेमाल करने के तरीकों की जानकारी देते हैं. डेवलपर गाइड में अन्य सामान्य कामों के लिए भी कोड स्निपेट दिए गए हैं.
सेंसर से मिला डेटा पढ़ें
किसी डेटा सोर्स से, प्रोसेस नहीं किया गया सेंसर डेटा पढ़ने के लिए, लिसनर को रजिस्टर करने के लिए GitHub कोड का सैंपल.
Fit के स्टोरेज में डेटा रिकॉर्ड करना
सदस्यताएं बनाकर, सेंसर के डेटा को अपने-आप सेव करने का अनुरोध करने के लिए, GitHub कोड का सैंपल.
Google Fit का डेटा पढ़ें
उपयोगकर्ता की फ़िटनेस के इतिहास से डेटा पढ़ने के लिए, GitHub कोड का सैंपल.
सेशन के साथ काम करें
सेशन दिखाने के लिए GitHub कोड का सैंपल:
पूरे वर्कआउट को दिखाने के लिए, फ़िटनेस डेटा को लॉजिकल सेशन के तौर पर शामिल करें.
स्टेप काउंटर
चरण रिकॉर्ड करने और उन्हें पढ़ने के लिए GitHub कोड सैंपल.
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 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)."]]