API ของ Google Fit ซึ่งรวมถึง Google Fit REST API จะเลิกใช้งานในปี 2026 ตั้งแต่วันที่ 1 พฤษภาคม 2024 เป็นต้นไป นักพัฒนาแอปจะลงชื่อสมัครใช้เพื่อใช้ API เหล่านี้ไม่ได้
การยกเลิกการเชื่อมต่อจาก Google Fit จะเพิกถอนสิทธิ์ OAuth ทั้งหมดที่ได้รับอนุญาตสำหรับ
แอปและลบการสมัครรับข้อมูลและการลงทะเบียนเซ็นเซอร์ทั้งหมดที่ทำขึ้นโดย
แอปของคุณ
คุณต้องระบุตัวเลือกยกเลิกการเชื่อมต่อจาก Google Fit ให้กับผู้ใช้ในการตั้งค่าแอป เมื่อผู้ใช้เลือกตัวเลือกนี้ คุณจะเรียกใช้วิธีต่อไปนี้เพื่อปิดใช้ Google Fit ได้
ConfigClient.disableFit
Kotlin
Fitness.getConfigClient(this,GoogleSignIn.getAccountForExtension(this,fitnessOptions)).disableFit().addOnSuccessListener{Log.i(TAG,"Disabled Google Fit")}.addOnFailureListener{e->
Log.w(TAG,"There was an error disabling Google Fit",e)}
Java
Fitness.getConfigClient(this,GoogleSignIn.getAccountForExtension(this,fitnessOptions)).disableFit().addOnSuccessListener(unused->
Log.i(TAG,"Disabled Google Fit")).addOnFailureListener(e->
Log.w(TAG,"There was an error disabling Google Fit",e));
[[["เข้าใจง่าย","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-05-08 UTC"],[[["Disconnecting from Google Fit removes all app permissions, data recording subscriptions, and sensor registrations."],["Apps need to provide a \"Disconnect from Google Fit\" option, triggering the `ConfigClient.disableFit()` method for disconnection."],["`ConfigClient.disableFit()` revokes Google Fit access and stops data collection by the app."]]],[]]