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));