Ngắt kết nối khỏi Google Fit
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Việc ngắt kết nối với Google Fit sẽ thu hồi tất cả quyền OAuth đã cấp cho ứng dụng của bạn và xoá tất cả gói thuê bao ghi và lượt đăng ký cảm biến do ứng dụng của bạn thực hiện.
Bạn cần cung cấp cho người dùng tùy chọn Ngắt kết nối khỏi Google Fit
trong phần cài đặt ứng dụng. Khi người dùng chọn tuỳ chọn này, bạn có thể gọi phương thức ConfigClient.disableFit
để tắt Google Fit:
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));
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-31 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-31 UTC."],[[["\u003cp\u003eDisconnecting from Google Fit removes all app permissions, data recording subscriptions, and sensor registrations.\u003c/p\u003e\n"],["\u003cp\u003eApps need to provide a "Disconnect from Google Fit" option, triggering the \u003ccode\u003eConfigClient.disableFit()\u003c/code\u003e method for disconnection.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eConfigClient.disableFit()\u003c/code\u003e revokes Google Fit access and stops data collection by the app.\u003c/p\u003e\n"]]],[],null,["# Disconnect from Google Fit\n\nDisconnecting from Google Fit revokes all granted OAuth permissions for your\napp and removes all recording subscriptions and sensor registrations made by\nyour app.\n\nYou need to provide users with a **Disconnect from Google Fit** option\nin your app settings. When users select this option, you can call the\n[`ConfigClient.disableFit`](/android/reference/com/google/android/gms/fitness/ConfigClient#public-taskvoid-disablefit)\nmethod to disable Google Fit: \n\n### Kotlin\n\n```kotlin\nFitness.getConfigClient(this, GoogleSignIn.getAccountForExtension(this, fitnessOptions))\n .disableFit()\n .addOnSuccessListener {\n Log.i(TAG,\"Disabled Google Fit\")\n }\n .addOnFailureListener { e -\u003e\n Log.w(TAG,\"There was an error disabling Google Fit\", e)\n }\n```\n\n### Java\n\n```java\nFitness.getConfigClient(this, GoogleSignIn.getAccountForExtension(this, fitnessOptions))\n .disableFit()\n .addOnSuccessListener(unused -\u003e\n Log.i(TAG, \"Disabled Google Fit\"))\n .addOnFailureListener(e -\u003e\n Log.w(TAG, \"There was an error disabling Google Fit\", e));\n```"]]